Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.85
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.bouncycastle.crypto.digests
Class Blake2bDigest

    java.lang.Object
      org.bouncycastle.crypto.digests.Blake2bDigest

All Implemented Interfaces:
  Digest, ExtendedDigest

public class Blake2bDigest
extends java.lang.Object
implements ExtendedDigest

Implementation of the cryptographic hash function BLAKE2b. BLAKE2b is optimized for 64-bit platforms and produces digests of any size between 1 and 64 bytes.

BLAKE2b offers a built-in keying mechanism to be used directly for authentication ("Prefix-MAC") rather than an HMAC construction.

BLAKE2b offers built-in support for a salt for randomized hashing and a personal string for defining a unique hash function for each application.

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Blake2bDigest

    public Blake2bDigest()

### Blake2bDigest

    public Blake2bDigest(int digestSize)

  Basic sized constructor - size in bits.

Parameters:
  `digestSize` - size of digest (in bits)

### Blake2bDigest

    public Blake2bDigest(Blake2bDigest digest)

### Blake2bDigest

    public Blake2bDigest(int digestSize,
                         CryptoServicePurpose purpose)

  Basic sized constructor with purpose.

Parameters:
  `digestSize` - size of the digest in bits
  `purpose` - usage purpose.

### Blake2bDigest

    public Blake2bDigest(byte[] key)

  BLAKE2b 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.

Parameters:
  `key` - A key up to 64 bytes or null

### Blake2bDigest

    public Blake2bDigest(byte[] key,
                         CryptoServicePurpose purpose)

### Blake2bDigest

    public Blake2bDigest(byte[] key,
                         int digestLength,
                         byte[] salt,
                         byte[] personalization)

  BLAKE2b with key, required digest length (in bytes), 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.

Parameters:
  `key` - A key up to 64 bytes or null
  `digestLength` - from 1 up to 64 bytes
  `salt` - 16 bytes or null
  `personalization` - 16 bytes or null

### Blake2bDigest

    public Blake2bDigest(byte[] key,
                         int digestLength,
                         byte[] salt,
                         byte[] personalization,
                         CryptoServicePurpose purpose)

### Blake2bDigest

    public Blake2bDigest(byte[] key,
                         byte[] param)

Method Detail

### update

    public void update(byte b)

  update the message digest with a single byte.

  Specified by:
    `update` in interface `Digest`
  Parameters:
    `b` - the input byte to be entered.

### update

    public void update(byte[] message,
                       int offset,
                       int len)

  update the message digest with a block of bytes.

  Specified by:
    `update` in interface `Digest`
  Parameters:
    `message` - the byte array containing the data.
    `offset` - the offset into the byte array where the data starts.
    `len` - the length of the data.

### doFinal

    public int doFinal(byte[] out,
                       int outOffset)

  Close the digest, producing the final digest value. The doFinal() call leaves the digest reset. Key, salt and personal string remain.

  Specified by:
    `doFinal` in interface `Digest`
  Parameters:
    `out` - the array the digest is to be copied into.
    `outOffset` - the offset into the out array the digest is to start at.

### reset

    public void reset()

  Reset the digest back to it's initial state. The key, the salt and the personal string will remain for further computations.

  Specified by:
    `reset` in interface `Digest`

### setAsLastNode

    protected void setAsLastNode()

### getAlgorithmName

    public java.lang.String getAlgorithmName()

  return the algorithm name

  Specified by:
    `getAlgorithmName` in interface `Digest`
  Returns:
    the algorithm name

### getDigestSize

    public int getDigestSize()

  return the size, in bytes, of the digest produced by this message digest.

  Specified by:
    `getDigestSize` in interface `Digest`
  Returns:
    the size, in bytes, of the digest produced by this message digest.

### getByteLength

    public int getByteLength()

  Return the size in bytes of the internal buffer the digest applies it's compression function to.

  Specified by:
    `getByteLength` in interface `ExtendedDigest`
  Returns:
    byte length of the digests internal buffer.

### clearKey

    public void clearKey()

  Overwrite the key if it is no longer used (zeroization)

### clearSalt

    public void clearSalt()

  Overwrite the salt (pepper) if it is secret and no longer used (zeroization)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.85
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD