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.​Shake128
Assembly: System.Security.Cryptography
Inheritance: object → Shake128
Implemented Interfaces
Computes the SHAKE128 hash 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
Shake128
Clone​()
Creates a new instance of <see cref="T:System.Security.Cryptography.Shake128" /> with the existing appended data preserved.
Returns A clone of the current instance.
public
void
Dispose​()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
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[] source,
int outputLength)
Computes the hash of data using the SHAKE128 algorithm.
Returns The hash of the data.
source
The data to hash.
outputLength
The size of the hash to produce.
public static
byte[]
HashData​(IO.​Stream source,
int outputLength)
Computes the hash of a stream using the SHAKE128 algorithm.
Returns The hash of the data.
source
The stream to hash.
outputLength
The size of the hash to produce.
public static
void
HashData​(IO.​Stream source,
Span<​byte> destination)
Computes the hash of a stream using the SHAKE128 algorithm.
source
The stream to hash.
destination
The buffer to fill with the hash.
public static
byte[]
HashData​(ReadOnlySpan<​byte> source,
int outputLength)
Computes the hash of data using the SHAKE128 algorithm.
Returns The hash of the data.
source
The data to hash.
outputLength
The size of the hash to produce.
public static
void
HashData​(ReadOnlySpan<​byte> source,
Span<​byte> destination)
Computes the hash of data using the SHAKE128 algorithm.
source
The data to hash.
destination
The buffer to fill with the hash.
public static
Threading.​Tasks.​ValueTask<​byte[]>
HashDataAsync​(IO.​Stream source,
int outputLength,
Threading.​CancellationToken cancellationToken = null)
Asynchronously computes the hash of a stream using the SHAKE128 algorithm.
Returns A <see cref="T:System.Threading.Tasks.ValueTask`1" /> that completes with the computed hash.
source
The stream to hash.
outputLength
The size of the hash to produce.
cancellationToken
The token to monitor for cancellation requests.
The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
HashDataAsync​(IO.​Stream source,
Memory<​byte> destination,
Threading.​CancellationToken cancellationToken = null)
Asynchronously computes the hash of a stream using the SHAKE128 algorithm.
Returns A <see cref="T:System.Threading.Tasks.ValueTask" /> that represents the asynchronous operation.
source
The stream to hash.
destination
The buffer to fill with the hash.
cancellationToken
The token to monitor for cancellation requests.
The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
public
byte[]
Read​(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 and allowing additional calls to continue retrieving the hash.
Returns The computed hash.
outputLength
The size of the hash to produce.
public
void
Read​(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 and allowing additional calls to continue retrieving the hash.
destination
The buffer to fill with the hash.
public
void
Reset​()
Resets the instance back to its initial state.
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