Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ MacData()

static int System.Security.Cryptography.HashOneShotHelpers.MacData ( HashAlgorithmName hashAlgorithm,
ReadOnlySpan< byte > key,
ReadOnlySpan< byte > source,
Span< byte > destination )
inlinestatic

Definition at line 5 of file HashOneShotHelpers.cs.

6 {
7 if (hashAlgorithm == HashAlgorithmName.SHA256)
8 {
9 return HMACSHA256.HashData(key, source, destination);
10 }
11 if (hashAlgorithm == HashAlgorithmName.SHA1)
12 {
13 return HMACSHA1.HashData(key, source, destination);
14 }
15 if (hashAlgorithm == HashAlgorithmName.SHA512)
16 {
17 return HMACSHA512.HashData(key, source, destination);
18 }
19 if (hashAlgorithm == HashAlgorithmName.SHA384)
20 {
21 return HMACSHA384.HashData(key, source, destination);
22 }
23 if (hashAlgorithm == HashAlgorithmName.MD5)
24 {
25 return HMACMD5.HashData(key, source, destination);
26 }
27 throw new CryptographicException(System.SR.Format(System.SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name));
28 }
static string Cryptography_UnknownHashAlgorithm
Definition SR.cs:152
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7

References System.SR.Cryptography_UnknownHashAlgorithm, System.destination, System.SR.Format(), System.Security.Cryptography.HMACMD5.HashData(), System.Security.Cryptography.HMACSHA1.HashData(), System.Security.Cryptography.HMACSHA256.HashData(), System.Security.Cryptography.HMACSHA384.HashData(), System.Security.Cryptography.HMACSHA512.HashData(), System.key, System.Security.Cryptography.HashAlgorithmName.MD5, System.Security.Cryptography.HashAlgorithmName.Name, System.Security.Cryptography.HashAlgorithmName.SHA1, System.Security.Cryptography.HashAlgorithmName.SHA256, System.Security.Cryptography.HashAlgorithmName.SHA384, System.Security.Cryptography.HashAlgorithmName.SHA512, and System.source.

Referenced by System.Security.Cryptography.HKDF.Extract().