Blake2b Class
Namespace: Rebex.Security.Cryptography
Assembly: Rebex.Security.dll (version 7.0.9313)
This class represents the BLAKE2b cryptographic hash and message authentication code (MAC) algorithm with custom (user-defined) hash size. Specified by RFC 7693. BLAKE2 provides better security than SHA-2 (it is comparable to that of SHA-3).
Syntax
public class Blake2b : KeyedHashAlgorithm, ICryptoTransform, IDisposableInherited Members
Examples
// sourceData argument contains data to be hashed.
// hashSizeInBytes argument specifies the requested hash size (1-64 bytes).
public byte[] CalculateHash(byte[] sourceData, int hashSizeInBytes)
{
    // create an instance of Blake2b class
    using (var blake2b = new Blake2b(hashSizeInBytes))
    {
        // compute and return the hash
        return blake2b.ComputeHash(sourceData);
    } // blake2b instance is disposed
}Constructors
| Name | Description | 
|---|---|
| Blake2b(Int32) | Initializes a new instance of the Blake2b class. | 
| Blake2b(Int32, Byte[]) | Initializes a new instance of the Blake2b class. | 
Properties
| Name | Description | 
|---|---|
| CanReuseTransform | Gets a value indicating whether the current transform can be reused. | 
| CanTransformMultipleBlocks | Gets the value indicating whether the instance can transform multiple blocks. | 
| HashSize | Gets the size of the hash in bits. | 
| Key | Key to use in HMAC calculations. The key must be a 0 - 64 bytes long array or null. When a null value is provided, the key is treated as an empty array. When the key is null or an empty array, the instance will calculate hashes. When the key is 1 - 64 bytes long, the instance will calculate message authentication codes (HMAC). An instance of the Blake2b class creates, uses, and clears a copy of key. An instance of the Blake2b class is not the owner of the key. Every call of the get accessor returns a new deep copy of the key. and the key will not be cleared when the Dispose(Boolean) method is called. | 
Methods
| Name | Description | 
|---|---|
| Dispose(Boolean) | Releases the resources used by this instance of the Blake2b class. | 
| HashCore(Byte[], Int32, Int32) | Hashes the specified segment of the specified  | 
| HashCore(ReadOnlySpan<Byte>) | Hashes the specified  | 
| HashFinal() | Finishes hash computation. | 
| Initialize() | Resets the instance to its initial state. Discards all data from the previous or current hash computation. | 
| TryHashFinal(Span<Byte>, out Int32) | Finishes hash computation. |