Table of Contents

HmacSecureHashAlgorithm512 Class

Definition

Namespace
Cuemon.Security.Cryptography
Assemblies
Cuemon.Security.Cryptography.dll
Source
src/Cuemon.Security.Cryptography/HmacSecureHashAlgorithm512.cs

Provides a Hash-based Message Authentication Code (HMAC) by using the SHA512 hash function. This class cannot be inherited. Implements the KeyedCryptoHash<TAlgorithm>

public sealed class HmacSecureHashAlgorithm512 : KeyedCryptoHash<HMACSHA512>, IHash, IConfigurable<ConvertibleOptions>
Inheritance
HmacSecureHashAlgorithm512
Implements
Inherited Members

Examples

The following example demonstrates how different payloads produce different HMAC-SHA512 values with .

using System;
using System.Text;
using Cuemon.Security.Cryptography;

namespace MyApp.Examples;

public static class HmacSecureHashAlgorithm512Example
{
    public static void Demonstrate()
    {
        var secret = Encoding.UTF8.GetBytes("docs-secret-sha512");
        var algorithm = new HmacSecureHashAlgorithm512(secret, null);
        var first = algorithm.ComputeHash(Encoding.UTF8.GetBytes("first"));
        var second = algorithm.ComputeHash(Encoding.UTF8.GetBytes("second"));

        Console.WriteLine(first.GetBytes().Length);
        Console.WriteLine(!first.Equals(second));
    }
}

Constructors

Name Description
HmacSecureHashAlgorithm512(byte[], Action<ConvertibleOptions>)

Initializes a new instance of the HmacSecureHashAlgorithm512 class.

See Also

Hash<TOptions>