Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

Blake2b Class

Namespace: Rebex.Security.Cryptography
Assembly: Rebex.Security.dll (version 7.0.9147)

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, IDisposable
Inheritance
Object
HashAlgorithm
KeyedHashAlgorithm
Blake2b
Blake2b256
Blake2b384
Blake2b512
Implements
ICryptoTransform
IDisposable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
HashAlgorithm.Clear()
HashAlgorithm.ComputeHash(Byte[])
HashAlgorithm.ComputeHash(Byte[], Int32, Int32)
HashAlgorithm.ComputeHash(Stream)
HashAlgorithm.ComputeHashAsync(Stream, CancellationToken)
HashAlgorithm.Dispose()
HashAlgorithm.Hash
HashAlgorithm.HashSizeValue
HashAlgorithm.HashValue
HashAlgorithm.InputBlockSize
HashAlgorithm.OutputBlockSize
HashAlgorithm.State
HashAlgorithm.TransformBlock(Byte[], Int32, Int32, Byte[], Int32)
HashAlgorithm.TransformFinalBlock(Byte[], Int32, Int32)
HashAlgorithm.TryComputeHash(ReadOnlySpan<Byte>, Span<Byte>, Int32)
KeyedHashAlgorithm.Create()
KeyedHashAlgorithm.Create(String)
KeyedHashAlgorithm.KeyValue
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 array.

HashCore(ReadOnlySpan<Byte>)

Hashes the specified source span.

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.

See Also

Blake2b256
Blake2b384
Blake2b512
HashData(ArraySegment<Byte>, ArraySegment<Byte>)
HashData(ArraySegment<Byte>, ArraySegment<Byte>)
HashData(ArraySegment<Byte>, ArraySegment<Byte>)
In This Article
  • Constructors
  • Properties
  • Methods
  • See Also
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies