Show / Hide Table of Contents

Class Blake2BHasher

Init/Update/Final for Blake2 hash.

Inheritance
object
Hasher
Blake2BHasher
Implements
IDisposable
Inherited Members
Hasher.Update(byte[], int, int)
Hasher.Update(byte[])
Hasher.AsHashAlgorithm()
Hasher.Dispose()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Isopoh.Cryptography.Blake2b
Assembly: Isopoh.Cryptography.Blake2b.dll
Syntax
public class Blake2BHasher : Hasher, IDisposable

Constructors

| Edit this page View Source

Blake2BHasher(Blake2BConfig?, SecureArrayCall)

Initializes a new instance of the Blake2BHasher class.

Declaration
public Blake2BHasher(Blake2BConfig? config, SecureArrayCall secureArrayCall)
Parameters
Type Name Description
Blake2BConfig config

The configuration to use; may be null to use the default Blake2 configuration.

SecureArrayCall secureArrayCall

Used to create SecureArray instances.

| Edit this page View Source

Blake2BHasher(Blake2BConfig?, Memory<byte>)

Initializes a new instance of the Blake2BHasher class.

Declaration
public Blake2BHasher(Blake2BConfig? config, Memory<byte> blake2BHasherBuffer)
Parameters
Type Name Description
Blake2BConfig config

The configuration to use; may be null to use the default Blake2 configuration.

Memory<byte> blake2BHasherBuffer

Must be at least BufferMinimumTotalSize + (config?.Key.Length ?? 0).

Exceptions
Type Condition
ArgumentException

.Length too small.

Fields

| Edit this page View Source

BufferMinimumTotalSize

Gets the minimum total size in bytes of the Blake2BHasher buffer. This length plus the length of the optional Blake2BConfig.Key field is the total required size.

Declaration
public const int BufferMinimumTotalSize = 512
Field Value
Type Description
int
| Edit this page View Source

NoKeyBufferMinimumTotalSize

Gets the minimum total size in bytes of the Blake2BHasher buffer. This length plus the length of the optional Blake2BConfig.Key field is the total required size.

Declaration
public const int NoKeyBufferMinimumTotalSize = 384
Field Value
Type Description
int

Properties

| Edit this page View Source

Iv

Gets the initialization vector used for the Blake2B hash.

Declaration
public ReadOnlySpan<ulong> Iv { get; }
Property Value
Type Description
ReadOnlySpan<ulong>
| Edit this page View Source

Key

Gets the key used for the Blake2B hash.

Declaration
public ReadOnlySpan<byte> Key { get; }
Property Value
Type Description
ReadOnlySpan<byte>

Methods

| Edit this page View Source

Dispose(bool)

Disposes resources if disposing is true.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

Set to true if disposing.

Overrides
Hasher.Dispose(bool)
| Edit this page View Source

Finish()

Either returns Blake2BConfig.Result64ByteBuffer or a new buffer of Blake2BConfig.OutputSizeInBytes if no Result64ByteBuffer was given.

Declaration
public override Memory<byte> Finish()
Returns
Type Description
Memory<byte>

Either the final Blake2 hash or the Result64ByteBuffer. If Result64ByteBuffer is non-null and Blake2BConfig.OutputSizeInBytes is less than 64, then the actual Blake2 hash is the first OutputSizeInBytes of the Result64ByteBuffer buffer.

Overrides
Hasher.Finish()
| Edit this page View Source

Finish(Span<byte>)

Finishes the hash and stores the results into hash. If a Result64ByteBuffer.Result64ByteBuffer was given, that will be loaded with the full hash. If the given hash is longer than Blake2B.OutputLength, it will be padded with zeros.

Declaration
public override Span<byte> Finish(Span<byte> hash)
Parameters
Type Name Description
Span<byte> hash

Loaded with the hash value.

Returns
Type Description
Span<byte>

The passed in hash.

Overrides
Hasher.Finish(Span<byte>)
| Edit this page View Source

Init()

Initialize the hasher. The hasher is initialized upon construction but this can be used to reinitialize in order to reuse the hasher.

Declaration
public override sealed void Init()
Overrides
Hasher.Init()
Exceptions
Type Condition
ObjectDisposedException

When called after being disposed.

| Edit this page View Source

Update(ReadOnlySpan<byte>)

Update the hasher with more bytes of data.

Declaration
public override void Update(ReadOnlySpan<byte> data)
Parameters
Type Name Description
ReadOnlySpan<byte> data

Buffer holding the data to update with.

Overrides
Hasher.Update(ReadOnlySpan<byte>)
Exceptions
Type Condition
ObjectDisposedException

When called after being disposed.

Implements

IDisposable
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX