public class SecureHashTextEncoder extends Object implements TextEncoder
Constructor and Description |
---|
SecureHashTextEncoder(SecureHash.Algorithm algorithm)
Create an encoder that uses the supplied algorithm and returns only the supplied number of characters in the hash.
|
SecureHashTextEncoder(SecureHash.Algorithm algorithm,
int maxLength)
Create an encoder that uses the supplied algorithm and returns only the supplied number of characters in the hash.
|
Modifier and Type | Method and Description |
---|---|
String |
encode(String text)
Returns the encoded version of a string.
|
SecureHash.Algorithm |
getAlgorithm()
Return the secure hash algorithm used by this encoder.
|
int |
getMaxLength()
Get the maximum length of the encoded string, or
Integer.MAX_VALUE if there is no maximum. |
public SecureHashTextEncoder(SecureHash.Algorithm algorithm)
algorithm
- the algorithm that should be usedIllegalArgumentException
- if the algorithm is nullpublic SecureHashTextEncoder(SecureHash.Algorithm algorithm, int maxLength)
algorithm
- the algorithm that should be usedmaxLength
- the maximumLength, or a non-positive number (or Integer.MAX_VALUE
) if the full hash should be usedIllegalArgumentException
- if the algorithm is nullpublic int getMaxLength()
Integer.MAX_VALUE
if there is no maximum.public SecureHash.Algorithm getAlgorithm()
public String encode(String text)
encode
in interface TextEncoder
text
- the text with characters that are to be encoded.TextEncoder.encode(java.lang.String)
Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.