BLAKE2s offers a built-in keying mechanism to be used directly for authentication ("Prefix-MAC") rather than a HMAC construction.
BLAKE2s offers a built-in support for a salt for randomized hashing and a personal string for defining a unique hash function for each application.
BLAKE2s is optimized for 32-bit platforms and produces digests of any size between 1 and 32 bytes.
| Modifier and Type | Field and Description |
|---|---|
| private static final int[] | blake2s_IV
BLAKE2s Initialization Vector |
| private static final byte[][] | blake2s_sigma
Message word permutations |
| private static final int | |
| private byte[] | buffer
Whenever this buffer overflows, it will be processed in the compress() function. |
| private int | bufferPos
Position of last inserted byte |
| private int[] | chainValue
State vector, in the BLAKE2 paper it is called h |
| private int | |
| private int | |
| private int | f0
finalization flag, for last block: ~0 |
| private int | |
| private int | |
| private int | |
| private int[] | internalState
Internal state, in the BLAKE2 paper it is called v |
| private boolean | |
| private byte[] | |
| private int | |
| private int | |
| private int | |
| private long | |
| private byte[] | |
| private final CryptoServicePurpose | |
| private static final int | |
| private byte[] | |
| private int | t0
holds least significant bits of counter |
| private int | t1
holds most significant bits of counter |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | Blake2sDigest(int
the desired digest length in bits. Must be a multiple of 8 and less than 256. digestBits, CryptoServicePurpose usage purpose. purpose)BLAKE2s for hashing. |
| public | Blake2sDigest(byte[]
a key up to 32 bytes or null key)BLAKE2s for authentication ("Prefix-MAC mode"). |
| public | |
| public | Blake2sDigest(byte[]
a key up to 32 bytes or null key, int from 1 up to 32 bytes digestBytes, byte[] 8 bytes or null salt, byte[] 8 bytes or null personalization)BLAKE2s with key, required digest length, salt and personalization. |
| public | Blake2sDigest(byte[] key, int digestBytes, byte[] salt, byte[] personalization, CryptoServicePurpose purpose)
|
| pack-priv | Blake2sDigest(int digestBytes, byte[] key, byte[] salt, byte[] personalization, long offset, CryptoServicePurpose purpose)
|
| pack-priv | |
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| private void | |
| public int | doFinal(byte[]
the array the digest is to be copied into. out, int the offset into the out array the digest is to start at. outOffset)Implements org. Close the digest, producing the final digest value. |
| private void | |
| public String | Returns: the algorithm nameImplements org. Return the algorithm name. |
| public int | Returns: byte length of the digest's internal buffer.Implements org. Return the size in bytes of the internal buffer the digest applies its compression function to. |
| public int | Returns: the size in bytes of the digest produced by this message digest.Implements org. Return the size in bytes of the digest produced by this message digest. |
| private void | |
| private void | |
| public void | |
| protected void | |
| public void | update(byte
the input byte to be entered. b)Implements org. Update the message digest with a single byte. |
| public void | update(byte[]
the byte array containing the data. message, int the offset into the byte array where the data starts. offset, int the length of the data. len)Implements org. Update the message digest with a block of bytes. |
| blake2s_IV | back to summary |
|---|---|
| private static final int[] blake2s_IV BLAKE2s Initialization Vector | |
| blake2s_sigma | back to summary |
|---|---|
| private static final byte[][] blake2s_sigma Message word permutations | |
| BLOCK_LENGTH_BYTES | back to summary |
|---|---|
| private static final int BLOCK_LENGTH_BYTES | |
| buffer | back to summary |
|---|---|
| private byte[] buffer Whenever this buffer overflows, it will be processed in the compress() function. For performance issues, long messages will not use this buffer. | |
| bufferPos | back to summary |
|---|---|
| private int bufferPos Position of last inserted byte | |
| chainValue | back to summary |
|---|---|
| private int[] chainValue State vector, in the BLAKE2 paper it is called h | |
| depth | back to summary |
|---|---|
| private int depth | |
| digestLength | back to summary |
|---|---|
| private int digestLength | |
| f0 | back to summary |
|---|---|
| private int f0 finalization flag, for last block: ~0 | |
| f1 | back to summary |
|---|---|
| private int f1 | |
| fanout | back to summary |
|---|---|
| private int fanout | |
| innerHashLength | back to summary |
|---|---|
| private int innerHashLength | |
| internalState | back to summary |
|---|---|
| private int[] internalState Internal state, in the BLAKE2 paper it is called v | |
| isLastNode | back to summary |
|---|---|
| private boolean isLastNode | |
| key | back to summary |
|---|---|
| private byte[] key | |
| keyLength | back to summary |
|---|---|
| private int keyLength | |
| leafLength | back to summary |
|---|---|
| private int leafLength | |
| nodeDepth | back to summary |
|---|---|
| private int nodeDepth | |
| nodeOffset | back to summary |
|---|---|
| private long nodeOffset | |
| personalization | back to summary |
|---|---|
| private byte[] personalization | |
| purpose | back to summary |
|---|---|
| private final CryptoServicePurpose purpose | |
| ROUNDS | back to summary |
|---|---|
| private static final int ROUNDS | |
| salt | back to summary |
|---|---|
| private byte[] salt | |
| t0 | back to summary |
|---|---|
| private int t0 holds least significant bits of counter | |
| t1 | back to summary |
|---|---|
| private int t1 holds most significant bits of counter | |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest() BLAKE2s-256 for hashing. | |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(int digestSize) Basic sized constructor - size in bits.
| |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(Blake2sDigest digest) | |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(int digestBits, CryptoServicePurpose purpose) BLAKE2s for hashing.
| |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(byte[] key) BLAKE2s for authentication ("Prefix-MAC mode"). After calling the doFinal() method, the key will remain to be used for further computations of this instance. The key can be overwritten using the clearKey() method.
| |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(byte[] key, CryptoServicePurpose purpose) | |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(byte[] key, int digestBytes, byte[] salt, byte[] personalization) BLAKE2s with key, required digest length, salt and personalization. After calling the doFinal() method, the key, the salt and the personal string will remain and might be used for further computations with this instance. The key can be overwritten using the clearKey() method, the salt (pepper) can be overwritten using the clearSalt() method.
| |
| Blake2sDigest | back to summary |
|---|---|
| public Blake2sDigest(byte[] key, int digestBytes, byte[] salt, byte[] personalization, CryptoServicePurpose purpose) | |
| Blake2sDigest | back to summary |
|---|---|
| pack-priv Blake2sDigest(int digestBytes, byte[] key, byte[] salt, byte[] personalization, long offset, CryptoServicePurpose purpose) | |
| Blake2sDigest | back to summary |
|---|---|
| pack-priv Blake2sDigest(int digestBytes, int hashLength, long offset) | |
| Blake2sDigest | back to summary |
|---|---|
| pack-priv Blake2sDigest(int digestBytes, int hashLength, long offset, CryptoServicePurpose purpose) | |
| Blake2sDigest | back to summary |
|---|---|
| pack-priv Blake2sDigest(byte[] key, byte[] param) | |
| clearKey | back to summary |
|---|---|
| public void clearKey() Overwrite the key if it is no longer used (zeroization). | |
| clearSalt | back to summary |
|---|---|
| public void clearSalt() Overwrite the salt (pepper) if it is secret and no longer used (zeroization). | |
| compress | back to summary |
|---|---|
| private void compress(byte[] message, int messagePos) | |
| doFinal | back to summary |
|---|---|
| public int doFinal(byte[] out, int outOffset) Implements org. Close the digest, producing the final digest value. The doFinal() call leaves the digest reset. Key, salt and personal string remain.
| |
| G | back to summary |
|---|---|
| private void G(int m1, int m2, int posA, int posB, int posC, int posD) | |
| getAlgorithmName | back to summary |
|---|---|
| public String getAlgorithmName() Implements org. Return the algorithm name.
| |
| getByteLength | back to summary |
|---|---|
| public int getByteLength() Implements org. Return the size in bytes of the internal buffer the digest applies its compression function to.
| |
| getDigestSize | back to summary |
|---|---|
| public int getDigestSize() Implements org. Return the size in bytes of the digest produced by this message digest.
| |
| init | back to summary |
|---|---|
| private void init(byte[] salt, byte[] personalization, byte[] key) | |
| initializeInternalState | back to summary |
|---|---|
| private void initializeInternalState() | |
| reset | back to summary |
|---|---|
| public void reset() Implements org. Reset the digest back to its initial state. The key, the salt and the personal string will remain for further computations. | |
| setAsLastNode | back to summary |
|---|---|
| protected void setAsLastNode() | |
| update | back to summary |
|---|---|
| public void update(byte b) Implements org. Update the message digest with a single byte.
| |
| update | back to summary |
|---|---|
| public void update(byte[] message, int offset, int len) Implements org. Update the message digest with a block of bytes.
| |