Class HmacSecureHashAlgorithm384
- Namespace
- Cuemon.Security.Cryptography
- Assembly
- Cuemon.Security.Cryptography.dll
Provides a Hash-based Message Authentication Code (HMAC) by using the SHA384 hash function. This class cannot be inherited. Implements the KeyedCryptoHash<TAlgorithm>
public sealed class HmacSecureHashAlgorithm384 : KeyedCryptoHash<HMACSHA384>, IHash, IConfigurable<ConvertibleOptions>
- Inheritance
-
HmacSecureHashAlgorithm384
- Implements
- Inherited Members
Examples
The following example demonstrates how to compute an HMAC-SHA384 hash with
using System;
using System.Text;
using Cuemon.Security.Cryptography;
namespace MyApp.Examples;
public static class HmacSecureHashAlgorithm384Example
{
public static void Demonstrate()
{
var secret = Encoding.UTF8.GetBytes("docs-secret-sha384");
var algorithm = new HmacSecureHashAlgorithm384(secret, null);
var result = algorithm.ComputeHash(Encoding.UTF8.GetBytes("Payload for SHA-384"));
Console.WriteLine(result.GetBytes().Length);
Console.WriteLine(result.ToBase64String());
}
}
Constructors
HmacSecureHashAlgorithm384(byte[], Action<ConvertibleOptions>)
Initializes a new instance of the HmacSecureHashAlgorithm384 class.
public HmacSecureHashAlgorithm384(byte[] secret, Action<ConvertibleOptions> setup)
Parameters
secretbyte[]The secret key for HmacSecureHashAlgorithm384 encryption. The key can be any length. However, the recommended size is 128 bytes. If the key is more than 128 bytes long, it is hashed (using SHA-384) to derive a 128-byte key. If it is less than 128 bytes long, it is padded to 128 bytes.
setupAction<ConvertibleOptions>The ConvertibleOptions which need to be configured.
See Also
Hash<TOptions>