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,
byte[] param) |
Blake2bDigest(byte[] key,
CryptoServicePurpose purpose) |
Blake2bDigest(byte[] key,
int digestLength,
byte[] salt,
byte[] personalization)
Blake2b with key, required digest length (in bytes), salt and personalization.
|
Blake2bDigest(byte[] key,
int digestLength,
byte[] salt,
byte[] personalization,
CryptoServicePurpose purpose) |
Blake2bDigest(int digestSize)
Basic sized constructor - size in bits.
|
Blake2bDigest(int digestSize,
CryptoServicePurpose purpose)
Basic sized constructor with purpose.
|
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.
|
protected void |
setAsLastNode() |
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(int digestSize)
digestSize
- size of digest (in bits)public Blake2bDigest(Blake2bDigest digest)
public Blake2bDigest(int digestSize, CryptoServicePurpose purpose)
digestSize
- size of the digest in bitspurpose
- usage purpose.public Blake2bDigest(byte[] key)
key
- A key up to 64 bytes or nullpublic Blake2bDigest(byte[] key, CryptoServicePurpose purpose)
public 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 Blake2bDigest(byte[] key, int digestLength, byte[] salt, byte[] personalization, CryptoServicePurpose purpose)
public Blake2bDigest(byte[] key, byte[] param)
public void update(byte b)
public void update(byte[] message, int offset, int len)
public int doFinal(byte[] out, int outOffset)
public void reset()
protected void setAsLastNode()
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()