Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Cryptography.​KmacXof128
Assembly: System.Security.Cryptography
Inheritance: object → KmacXof128
Implemented Interfaces
Computes the KMACXOF128 MAC for the input data.
Properties
public static
bool
IsSupported
Gets a value that indicates whether the algorithm is supported on the current platform.
Methods
public
void
AppendData​(byte[] data)
Appends the specified data to the data already processed in the hash.
data
The data to process.
public
void
AppendData​(ReadOnlySpan<​byte> data)
Appends the specified data to the data already processed in the hash.
data
The data to process.
public
KmacXof128
Clone​()
Creates a new instance of <see cref="T:System.Security.Cryptography.KmacXof128" /> with the existing appended data preserved.
Returns A clone of the current instance.
public
void
Dispose​()
Release all resources used by the current instance of the <see cref="T:System.Security.Cryptography.KmacXof128" /> class.
public
byte[]
GetCurrentHash​(int outputLength)
Retrieves the hash for the data accumulated from prior calls to the <c>AppendData</c> methods, without resetting the object to its initial state.
Returns The computed hash.
outputLength
The size of the hash to produce.
public
void
GetCurrentHash​(Span<​byte> destination)
Fills the buffer with the hash for the data accumulated from prior calls to the <c>AppendData</c> methods, without resetting the object to its initial state.
destination
The buffer to fill with the hash.
public
byte[]
GetHashAndReset​(int outputLength)
Retrieves the hash for the data accumulated from prior calls to the <c>AppendData</c> methods, and resets the object to its initial state.
Returns The computed hash.
outputLength
The size of the hash to produce.
public
void
GetHashAndReset​(Span<​byte> destination)
Fills the buffer with the hash for the data accumulated from prior calls to the <c>AppendData</c> methods, and resets the object to its initial state.
destination
The buffer to fill with the hash.
public static
byte[]
HashData​(byte[] key,
byte[] source,
int outputLength,
byte[] customizationString = null)
Computes the hash of data using the KMACXOF128 algorithm.
Returns The hash of the data.
key
The KMAC key.
source
The data to hash.
outputLength
The size of the hash to produce.
customizationString
An optional customization string. The default is no customization string.
public static
byte[]
HashData​(byte[] key,
IO.​Stream source,
int outputLength,
byte[] customizationString = null)
Computes the hash of a stream using the KMACXOF128 algorithm.
Returns The hash of the data.
key
The KMAC key.
source
The stream to hash.
outputLength
The size of the hash to produce.
customizationString
An optional customization string. The default is no customization string.
public static
byte[]
HashData​(ReadOnlySpan<​byte> key,
IO.​Stream source,
int outputLength,
ReadOnlySpan<​byte> customizationString = null)
Computes the hash of a stream using the KMACXOF128 algorithm.
Returns The hash of the data.
key
The KMAC key.
source
The stream to hash.
outputLength
The size of the hash to produce.
customizationString
An optional customization string. The default is no customization string.
public static
void
HashData​(ReadOnlySpan<​byte> key,
IO.​Stream source,
Span<​byte> destination,
ReadOnlySpan<​byte> customizationString = null)
Computes the hash of a stream using the KMACXOF128 algorithm.
key
The KMAC key.
source
The stream to hash.
destination
The buffer to fill with the hash.
customizationString
An optional customization string. The default is no customization string.
public static
byte[]
HashData​(ReadOnlySpan<​byte> key,
ReadOnlySpan<​byte> source,
int outputLength,
ReadOnlySpan<​byte> customizationString = null)
Computes the hash of data using the KMACXOF128 algorithm.
Returns The hash of the data.
key
The KMAC key.
source
The data to hash.
outputLength
The size of the hash to produce.
customizationString
An optional customization string. The default is no customization string.
public static
void
HashData​(ReadOnlySpan<​byte> key,
ReadOnlySpan<​byte> source,
Span<​byte> destination,
ReadOnlySpan<​byte> customizationString = null)
Computes the hash of data using the KMACXOF128 algorithm.
key
The KMAC key.
source
The data to hash.
destination
The buffer to fill with the hash.
customizationString
An optional customization string. The default is no customization string.
public static
Threading.​Tasks.​ValueTask<​byte[]>
HashDataAsync​(byte[] key,
IO.​Stream source,
int outputLength,
byte[] customizationString = null,
Threading.​CancellationToken cancellationToken = null)
Asynchronously computes the hash of a stream using the KMACXOF128 algorithm.
Returns A <see cref="T:System.Threading.Tasks.ValueTask`1" /> that completes with the computed hash.
key
The KMAC key.
source
The stream to hash.
outputLength
The size of the hash to produce.
customizationString
An optional customization string. The default is no customization string.
cancellationToken
The token to monitor for cancellation requests.
The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
public static
Threading.​Tasks.​ValueTask<​byte[]>
HashDataAsync​(ReadOnlyMemory<​byte> key,
IO.​Stream source,
int outputLength,
ReadOnlyMemory<​byte> customizationString = null,
Threading.​CancellationToken cancellationToken = null)
Asynchronously computes the hash of a stream using the KMACXOF128 algorithm.
Returns A <see cref="T:System.Threading.Tasks.ValueTask`1" /> that completes with the computed hash.
key
The KMAC key.
source
The stream to hash.
outputLength
The size of the hash to produce.
customizationString
An optional customization string. The default is no customization string.
cancellationToken
The token to monitor for cancellation requests.
The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
HashDataAsync​(ReadOnlyMemory<​byte> key,
IO.​Stream source,
Memory<​byte> destination,
ReadOnlyMemory<​byte> customizationString = null,
Threading.​CancellationToken cancellationToken = null)
Asynchronously computes the hash of a stream using the KMACXOF128 algorithm.
Returns A <see cref="T:System.Threading.Tasks.ValueTask" /> that represents the asynchronous operation.
key
The KMAC key.
source
The stream to hash.
destination
The buffer to fill with the hash.
customizationString
An optional customization string. The default is no customization string.
cancellationToken
The token to monitor for cancellation requests.
The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object