Klasse Salt
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final intThe default length of a salt string in bytes (16). -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic Stringget()Create a cryptographically secure hex-encoded salt value of thedefault lengthin bytes.static Stringget(byte[] p_key, int p_iLen) Create a hex-encoded salt value of the given length in bytes.static Stringget(int p_iLen) Create a cryptographically secure hex-encoded salt value of the given length in bytes.static byte[]Create cryptographically secure salt value of thedefault lengthin bytes.static byte[]getBinary(byte[] p_key, int p_iLen) Create a salt value of the given length in bytes.static byte[]getBinary(int p_iLen) Create a cryptographically secure salt value of the given length in bytes.static byte[]Convert the given hex string to bytes.static StringtoHex(byte[] p_buf) Convert the given bytes to a hex-encoded string.
-
Felddetails
-
DEFAULT_SALT_LENGTH
public static final int DEFAULT_SALT_LENGTHThe default length of a salt string in bytes (16).- Siehe auch:
-
-
Methodendetails
-
get
Create a cryptographically secure hex-encoded salt value of thedefault lengthin bytes.Note that the length of the returned hex-encoded string is twice of the length in bytes.
- Gibt zurück:
- The hex-encoded salt value.
- Siehe auch:
-
getBinary
public static byte[] getBinary()Create cryptographically secure salt value of thedefault lengthin bytes.- Gibt zurück:
- The salt value.
- Siehe auch:
-
get
Create a cryptographically secure hex-encoded salt value of the given length in bytes.Note that the length of the returned hex-encoded string is twice of the length in bytes.
- Parameter:
p_iLen- The length of the salt value in bytes.- Gibt zurück:
- The hex-encoded salt value.
-
getBinary
public static byte[] getBinary(int p_iLen) Create a cryptographically secure salt value of the given length in bytes.- Parameter:
p_iLen- The length of the salt value in bytes.- Gibt zurück:
- The salt value.
-
get
Create a hex-encoded salt value of the given length in bytes.The created salt is only cryptographically secure if the provided key material is cryptographically secure, i.e. contains cryptographically secure random bits.
The derived salt value contains at most 256 bits of entropy.
The given key material cannot be recovered from the generated salt.
Note that the length of the returned hex-encoded string is twice of the length in bytes.
- Parameter:
p_key- The key material that determines the value of the salt.p_iLen- The length of the salt value in bytes.- Gibt zurück:
- The hex-encoded salt value.
-
getBinary
public static byte[] getBinary(byte[] p_key, int p_iLen) Create a salt value of the given length in bytes.The created salt is only cryptographically secure if the provided key material is cryptographically secure, i.e. contains cryptographically secure random bits.
The derived salt value contains at most 256 bits of entropy.
The given key material cannot be recovered from the generated salt.
- Parameter:
p_key- The key material that determines the value of the salt.p_iLen- The length of the salt value in bytes.- Gibt zurück:
- The salt value.
-
toHex
Convert the given bytes to a hex-encoded string.- Parameter:
p_buf- The bytes to convert- Gibt zurück:
- The hex-encoded bytes.
-
toBinary
Convert the given hex string to bytes.- Parameter:
p_strHex- A string of hex-encoded bytes.- Gibt zurück:
- The decoded bytes.
- Löst aus:
IllegalArgumentException- If the input length is odd or if the input contains non-hexadecimal digits.
-