Class Blake2B
Convenience calls for performing Blake2 hashes.
Inheritance
Inherited Members
Namespace: Isopoh.Cryptography.Blake2b
Assembly: Isopoh.Cryptography.Blake2b.dll
Syntax
public static class Blake2B
Fields
| Improve this Doc View SourceOutputLength
The output length of the Blake2 hash in bytes.
Declaration
public const int OutputLength = 64
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
This is the maximum length buffer a Blake2 hash can produce Blake2 will always hash to this length even when configured to hash to a shorter value - the final step is to truncate the result.
Note, the length of the expected result is hashed into the result so the OutputLength-byte buffer will hold different values depending on the configured output length. Do not run Blake2 using the default length and then truncate and expect to get the same result as if you configured Blake2 to produce a shorter result.
Methods
| Improve this Doc View SourceComputeHash(Byte[], Blake2BConfig, SecureArrayCall)
Perform a Blake2 hash on the given buffer using the given Blake2 configuration.
Declaration
public static byte[] ComputeHash(byte[] data, Blake2BConfig config, SecureArrayCall secureArrayCall)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The buffer to hash. |
Blake2BConfig | config | The configuration to use. |
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
Returns
Type | Description |
---|---|
System.Byte[] | The hash of the buffer. |
ComputeHash(Byte[], SecureArrayCall)
Perform a default Blake2 hash on the given buffer.
Declaration
public static byte[] ComputeHash(byte[] data, SecureArrayCall secureArrayCall)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The buffer to hash. |
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
Returns
Type | Description |
---|---|
System.Byte[] | The hash of the buffer. |
ComputeHash(Byte[], Int32, Int32, Blake2BConfig, SecureArrayCall)
Perform a Blake2 hash on the given buffer using the given Blake2 configuration.
Declaration
public static byte[] ComputeHash(byte[] data, int start, int count, Blake2BConfig config, SecureArrayCall secureArrayCall)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The buffer to hash. |
System.Int32 | start | The byte in the buffer to start hashing. |
System.Int32 | count | The number of bytes to hash. |
Blake2BConfig | config | The configuration to use. |
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
Returns
Type | Description |
---|---|
System.Byte[] | The hash of the buffer. |
ComputeHash(Byte[], Int32, Int32, SecureArrayCall)
Perform a default Blake2 hash on the given buffer.
Declaration
public static byte[] ComputeHash(byte[] data, int start, int count, SecureArrayCall secureArrayCall)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The buffer to hash. |
System.Int32 | start | The byte in the buffer to start hashing. |
System.Int32 | count | The number of bytes to hash. |
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
Returns
Type | Description |
---|---|
System.Byte[] | The hash of the buffer. |
Create(Blake2BConfig, SecureArrayCall)
Create a Blake2 hash with the given configuration.
Declaration
public static Hasher Create(Blake2BConfig config, SecureArrayCall secureArrayCall)
Parameters
Type | Name | Description |
---|---|---|
Blake2BConfig | config | The configuration to use. |
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
Returns
Type | Description |
---|---|
Hasher | A Hasher that can be converted to a System.Security.Cryptography.HashAlgorithm. |
Create(SecureArrayCall)
Create a default Blake2 hash.
Declaration
public static Hasher Create(SecureArrayCall secureArrayCall)
Parameters
Type | Name | Description |
---|---|---|
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
Returns
Type | Description |
---|---|
Hasher | A Hasher that can be converted to a System.Security.Cryptography.HashAlgorithm. |