public class XmlSafeSaltedHashCodec extends Object implements SaltedHashCodec
SaltedHash to and from String.
The string representations produced by encode(SaltedHash) are granted to be valid XML element
names if the length of byte arrays returned by SaltedHash.getSalt() and SaltedHash.getHash() is divisible by
12. This important because encode(SaltedHash) uses the URL safe variant of Byte64 encoding
(see Base64) and for byte array lengths other than 12, the string encoded by Byte64 would have
to be padded with character '*' which would make the result an invalid XML name.| Modifier and Type | Field and Description |
|---|---|
static SaltedHashCodec |
INSTANCE |
| Constructor and Description |
|---|
XmlSafeSaltedHashCodec() |
| Modifier and Type | Method and Description |
|---|---|
SaltedHash |
decode(String encodedSaltedHash)
Parses the given
String to a SaltedHash. |
String |
encode(SaltedHash saltedHash)
Transforms the given
SaltedHash to String. |
protected byte[] |
toBytes(String str) |
protected String |
toString(byte[] bytes) |
public static final SaltedHashCodec INSTANCE
public String encode(SaltedHash saltedHash)
SaltedHashCodecSaltedHash to String.encode in interface SaltedHashCodecpublic SaltedHash decode(String encodedSaltedHash) throws SaltedHashEncodingException
SaltedHashCodecString to a SaltedHash.decode in interface SaltedHashCodecSaltedHashEncodingExceptionprotected String toString(byte[] bytes)
protected byte[] toBytes(String str)
Copyright © 2017 JBoss by Red Hat. All Rights Reserved.