circle-info
The documentation is currently being reviewed, so you may see some inconsistencies between sections.

Hashing

Purpose

BLAKE2barrow-up-right is a cryptographic hash function. It takes a message of any size and produces a 128-bit to 512-bit hash.

This hash acts as a fingerprint for the data. Hashes can be used to uniquely identify messages, detect corruption, detect duplicate data, and index data in a hash table.

It is also possible to personalize the output for your application/a specific use case via a constant and to randomize hashing by using a salt. The former provides domain separation, helping to avoid collisions between applications/use cases. The latter can also be used for this purpose but is primarily designed for digital signature schemes.

However, unkeyed hashes do not provide authentication (e.g., for Encrypt-then-MACarrow-up-right). Furthermore, they should be avoided for key derivation. Use the linked APIs instead.

triangle-exclamation
triangle-exclamation

Usage

ComputeHash

Fills a span with a hash computed from a message.

BLAKE2b.ComputeHash(Span<byte> hash, ReadOnlySpan<byte> message)

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

hash has a length less than MinHashSize or greater than MaxHashSize.

CryptographicExceptionarrow-up-right

Error computing hash.

ComputeHash

Fills a span with a personalized and/or salted hash computed from a message.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

hash has a length less than MinHashSize or greater than MaxHashSize.

ArgumentOutOfRangeExceptionarrow-up-right

personalization and salt both have a length of 0.

ArgumentOutOfRangeExceptionarrow-up-right

personalization has a length greater than 0 but not equal to PersonalizationSize.

ArgumentOutOfRangeExceptionarrow-up-right

salt has a length greater than 0 but not equal to SaltSize.

CryptographicExceptionarrow-up-right

Error computing personalized/salted hash.

IncrementalBLAKE2b

Provides support for computing a hash from several messages.

circle-exclamation

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

hashSize is less than MinHashSize or greater than MaxHashSize.

ArgumentOutOfRangeExceptionarrow-up-right

personalization has a length greater than 0 but not equal to PersonalizationSize.

ArgumentOutOfRangeExceptionarrow-up-right

salt has a length greater than 0 but not equal to SaltSize.

ArgumentOutOfRangeExceptionarrow-up-right

hash has a length not equal to hashSize.

CryptographicExceptionarrow-up-right

Error initializing/updating/finalizing hash function state.

InvalidOperationExceptionarrow-up-right

Cannot update after finalizing or finalize twice (without reinitializing or restoring a cached state).

InvalidOperationExceptionarrow-up-right

Cannot cache the state after finalizing (without reinitializing).

InvalidOperationExceptionarrow-up-right

Cannot restore the state when it has not been cached.

ObjectDisposedExceptionarrow-up-right

The object has been disposed.

Constants

These are used for validation and/or save you defining your own constants.

Notes

triangle-exclamation
circle-exclamation
circle-check
circle-check
circle-info

The security level of BLAKE2b is 1/2 the output length (e.g., 128-bit security for a 256-bit hash).​

Last updated