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.​HMACSHA512
Assembly: System.Security.Cryptography
Inheritance: object → HashAlgorithm → KeyedHashAlgorithm → HMAC → HMACSHA512
Computes a Hash-based Message Authentication Code (HMAC) using the <see cref="T:System.Security.Cryptography.SHA512" /> hash function.
Fields and Constants
public const
int
HashSizeInBits
The hash size produced by the HMAC SHA-512 algorithm, in bits.
public const
int
HashSizeInBytes
The hash size produced by the HMAC SHA-512 algorithm, in bytes.
protected
byte[]
KeyValue
The key to use in the hash algorithm.
protected
int
HashSizeValue
Represents the size, in bits, of the computed hash code.
protected
int
State
Represents the state of the hash computation.
Properties
public
byte[]
Key
Gets or sets the key to use in the HMAC calculation.
public
bool
ProduceLegacyHmacValues
Provides a workaround for the .NET Framework 2.0 implementation of the <see cref="T:System.Security.Cryptography.HMACSHA512" /> algorithm, which is inconsistent with the .NET Framework 2.0 Service Pack 1 implementation.
protected
int
BlockSizeValue
Gets or sets the block size to use in the hash value.
public
string
HashName
Gets or sets the name of the hash algorithm to use for hashing.
public
bool
CanReuseTransform
Gets a value indicating whether the current transform can be reused.
public
bool
CanTransformMultipleBlocks
When overridden in a derived class, gets a value indicating whether multiple blocks can be transformed.
public
byte[]
Hash
Gets the value of the computed hash code.
public
int
HashSize
Gets the size, in bits, of the computed hash code.
public
int
InputBlockSize
When overridden in a derived class, gets the input block size.
public
int
OutputBlockSize
When overridden in a derived class, gets the output block size.
Methods
protected
void
Dispose​(bool disposing)
disposing
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.
Releases the unmanaged resources used by the <see cref="T:System.Security.Cryptography.HMACSHA512" /> and optionally releases the managed resources.
protected
void
HashCore​(byte[] rgb,
int ib,
int cb)
rgb
The input to compute the HMAC for.
ib
The offset into the byte array from which to begin using data.
cb
The number of bytes in the byte array to use as data.
Routes data written to the object into the HMAC algorithm for computing the HMAC.
protected
byte[]
HashFinal​() Returns The computed HMAC value in a byte array.
Finalizes the HMAC computation after the last data is processed by the algorithm.
public
void
Initialize​()
Resets the hash algorithm to its initial state.
Releases all resources used by the <see cref="T:System.Security.Cryptography.HashAlgorithm" /> class.
public
byte[]
ComputeHash​(byte[] buffer)
Inherited from HashAlgorithm
buffer
The input to compute the hash code for.
Returns The computed hash code.
Computes the hash value for the specified byte array.
public
byte[]
ComputeHash​(byte[] buffer,
int offset,
int count)
Inherited from HashAlgorithm
buffer
The input to compute the hash code for.
offset
The offset into the byte array from which to begin using data.
count
The number of bytes in the array to use as data.
Returns The computed hash code.
Computes the hash value for the specified region of the specified byte array.
public
byte[]
ComputeHash​(IO.Stream inputStream)
Inherited from HashAlgorithm
inputStream
The input to compute the hash code for.
Returns The computed hash code.
Computes the hash value for the specified <see cref="T:System.IO.Stream" /> object.
ComputeHashAsync​(IO.Stream inputStream,
Threading.CancellationToken cancellationToken = null)
Inherited from HashAlgorithm
inputStream
The input to compute the hash code for.
cancellationToken
The token to monitor for cancellation requests.
Returns A task that represents the asynchronous compute hash operation and wraps the computed hash code.
Asynchronously computes the hash value for the specified <see cref="T:System.IO.Stream" /> object.
Releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.HashAlgorithm" /> class.
public
int
TransformBlock​(byte[] inputBuffer,
int inputOffset,
int inputCount,
byte[] outputBuffer,
int outputOffset)
Inherited from HashAlgorithm
inputBuffer
The input to compute the hash code for.
inputOffset
The offset into the input byte array from which to begin using data.
inputCount
The number of bytes in the input byte array to use as data.
outputBuffer
A copy of the part of the input array used to compute the hash code.
outputOffset
The offset into the output byte array from which to begin writing data.
Returns The number of bytes written.
Computes the hash value for the specified region of the input byte array and copies the specified region of the input byte array to the specified region of the output byte array.
public
byte[]
TransformFinalBlock​(byte[] inputBuffer,
int inputOffset,
int inputCount)
Inherited from HashAlgorithm
inputBuffer
The input to compute the hash code for.
inputOffset
The offset into the byte array from which to begin using data.
inputCount
The number of bytes in the byte array to use as data.
Returns An array that is a copy of the part of the input that is hashed.
Computes the hash value for the specified region of the specified byte array.
public
bool
TryComputeHash​(ReadOnlySpan`1 source,
Span`1 destination,
Int32& bytesWritten)
Inherited from HashAlgorithm
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