public class Blake2bDigest extends java.lang.Object implements ExtendedDigest
Blake2b offers a built-in keying mechanism to be used directly for authentication ("Prefix-MAC") rather than a HMAC construction.
Blake2b offers a built-in support for a salt for randomized hashing and a personal string for defining a unique hash function for each application.
BLAKE2b is optimized for 64-bit platforms and produces digests of any size between 1 and 64 bytes.
Constructor and Description |
---|
Blake2bDigest() |
Blake2bDigest(Blake2bDigest digest) |
Blake2bDigest(byte[] key)
Blake2b for authentication ("Prefix-MAC mode").
|
Blake2bDigest(byte[] key,
int digestLength,
byte[] salt,
byte[] personalization)
Blake2b with key, required digest length (in bytes), salt and personalization.
|
Blake2bDigest(int digestSize)
Basic sized constructor - size in bits.
|
Modifier and Type | Method and Description |
---|---|
void |
clearKey()
Overwrite the key
if it is no longer used (zeroization)
|
void |
clearSalt()
Overwrite the salt (pepper) if it
is secret and no longer used (zeroization)
|
int |
doFinal(byte[] out,
int outOffset)
close the digest, producing the final digest value.
|
java.lang.String |
getAlgorithmName()
return the algorithm name
|
int |
getByteLength()
Return the size in bytes of the internal buffer the digest applies it's compression
function to.
|
int |
getDigestSize()
return the size, in bytes, of the digest produced by this message digest.
|
void |
reset()
Reset the digest back to it's initial state.
|
void |
update(byte b)
update the message digest with a single byte.
|
void |
update(byte[] message,
int offset,
int len)
update the message digest with a block of bytes.
|
public Blake2bDigest()
public Blake2bDigest(Blake2bDigest digest)
public Blake2bDigest(int digestSize)
digestSize
- size of the digest in bitspublic Blake2bDigest(byte[] key)
key
- A key up to 64 bytes or nullpublic Blake2bDigest(byte[] key, int digestLength, byte[] salt, byte[] personalization)
key
- A key up to 64 bytes or nulldigestLength
- from 1 up to 64 bytessalt
- 16 bytes or nullpersonalization
- 16 bytes or nullpublic void update(byte b)
public void update(byte[] message, int offset, int len)
public int doFinal(byte[] out, int outOffset)
public void reset()
public java.lang.String getAlgorithmName()
getAlgorithmName
in interface Digest
public int getDigestSize()
getDigestSize
in interface Digest
public int getByteLength()
getByteLength
in interface ExtendedDigest
public void clearKey()
public void clearSalt()