Files
Dec2017-Script-Dump/mscorlib/System/Security/Cryptography/HMACSHA512.cs
T
2026-06-04 11:42:34 +02:00

57 lines
2.5 KiB
C#

using System;
using System.Runtime.InteropServices;
using Mono.Security.Cryptography;
namespace System.Security.Cryptography
{
/// <summary>Computes a Hash-based Message Authentication Code (HMAC) using the <see cref="T:System.Security.Cryptography.SHA512" /> hash function.</summary>
// Token: 0x02000507 RID: 1287
[ComVisible(true)]
public class HMACSHA512 : HMAC
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA512" /> class with a randomly generated key.</summary>
// Token: 0x06002F6A RID: 12138 RVA: 0x00098C50 File Offset: 0x00096E50
public HMACSHA512()
: this(KeyBuilder.Key(8))
{
this.ProduceLegacyHmacValues = HMACSHA512.legacy_mode;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.HMACSHA512" /> class with the specified key data.</summary>
/// <param name="key">The secret key for <see cref="T:System.Security.Cryptography.HMACSHA512" /> encryption. The key can be any length. However, if it is more than 64 bytes long it will be hashed (using SHA-1) to derive a 64-byte key. Therefore, the recommended size of the secret key is 64 bytes. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is null. </exception>
// Token: 0x06002F6B RID: 12139 RVA: 0x00098C6C File Offset: 0x00096E6C
public HMACSHA512(byte[] key)
{
this.ProduceLegacyHmacValues = HMACSHA512.legacy_mode;
base.HashName = "SHA512";
this.HashSizeValue = 512;
this.Key = key;
}
/// <summary>Provides a workaround for the .NET Framework version 2.0 implementation of the <see cref="T:System.Security.Cryptography.HMACSHA512" /> algorithm, which is inconsistent with the .NET Framework version 2.0 Service Pack 1 implementation.</summary>
/// <returns>true to enable .NET Framework version 2.0 Service Pack 1 applications to interact with .NET Framework 2.0 applications; otherwise, false.</returns>
// Token: 0x1700095C RID: 2396
// (get) Token: 0x06002F6D RID: 12141 RVA: 0x00098CC4 File Offset: 0x00096EC4
// (set) Token: 0x06002F6E RID: 12142 RVA: 0x00098CCC File Offset: 0x00096ECC
public bool ProduceLegacyHmacValues
{
get
{
return this.legacy;
}
set
{
this.legacy = value;
base.BlockSizeValue = ((!this.legacy) ? 128 : 64);
}
}
// Token: 0x04001358 RID: 4952
private static bool legacy_mode = Environment.GetEnvironmentVariable("legacyHMACMode") == "1";
// Token: 0x04001359 RID: 4953
private bool legacy;
}
}