Class Blake2BCore
The core of the Blake2 hash.
Inheritance
Implements
Inherited Members
Namespace: Isopoh.Cryptography.Blake2b
Assembly: Isopoh.Cryptography.Blake2b.dll
Syntax
public sealed class Blake2BCore : IDisposable
Constructors
| Improve this Doc View SourceBlake2BCore(SecureArrayCall, LockMemoryPolicy)
Initializes a new instance of the Blake2BCore class.
Declaration
public Blake2BCore(SecureArrayCall secureArrayCall, LockMemoryPolicy lockMemory = LockMemoryPolicy.BestEffort)
Parameters
Type | Name | Description |
---|---|---|
SecureArrayCall | secureArrayCall | The methods that get called to secure arrays. A null value defaults to SecureArray.DefaultCall. |
LockMemoryPolicy | lockMemory | Used to set locking strategy for buffers used in creating the hash. The memory will always be zeroed prior to destruction. The memory is also always pinned so the CLR can't move it and leave extraneous copies floating around in RAM. |
Methods
| Improve this Doc View SourceBytesToUInt64(Byte[], Int32)
Convert a big-endian buffer into a System.UInt64.
Declaration
public static ulong BytesToUInt64(byte[] buf, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buf | Buffer holding an 8-byte big-endian ulong. |
System.Int32 | offset | Offset into the buffer to start reading the ulong. |
Returns
Type | Description |
---|---|
System.UInt64 | The parsed ulong. |
Remarks
No checking is done to verify that an 8-byte value can be read from buf
at offset
.
Dispose()
Release unmanaged resources.
Declaration
public void Dispose()
HashCore(Byte[], Int32, Int32)
Update the hash state.
Declaration
public void HashCore(byte[] array, int start, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array | Data to use to update the hash state. |
System.Int32 | start | Index of the first byte in |
System.Int32 | count | Number of bytes in |
HashFinal()
Return the hash.
Declaration
public byte[] HashFinal()
Returns
Type | Description |
---|---|
System.Byte[] | The 64-byte hash. |
HashFinal(Boolean)
Return the hash.
Declaration
public byte[] HashFinal(bool isEndOfLayer)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isEndOfLayer | True to signal the last node of a layer in tree-hashing mode; false otherwise. |
Returns
Type | Description |
---|---|
System.Byte[] | The 64-byte hash. |
HashFinal(Byte[])
Compute the hash.
Declaration
public byte[] HashFinal(byte[] hash)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | hash | Loaded with the hash. |
Returns
Type | Description |
---|---|
System.Byte[] |
|
HashFinal(Byte[], Boolean)
Compute the hash.
Declaration
public byte[] HashFinal(byte[] hash, bool isEndOfLayer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | hash | Loaded with the hash. |
System.Boolean | isEndOfLayer | True to signal the last node of a layer in tree-hashing mode; false otherwise. |
Returns
Type | Description |
---|---|
System.Byte[] |
|
Initialize(UInt64[])
Initialize the hash.
Declaration
public void Initialize(ulong[] config)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64[] | config | 8-element configuration array. |
UInt64ToBytes(UInt64, Byte[], Int32)
Store a ulong into a byte buffer as big-endian.
Declaration
public static void UInt64ToBytes(ulong value, byte[] buf, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | value | The ulong to store. |
System.Byte[] | buf | The buffer to load the 8-byte value into. |
System.Int32 | offset | The offset to start |
Remarks
No checking is done to validate the buffer can store value
at offset
.