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

◆ MacData()

static int Internal.Cryptography.HashProviderDispenser.OneShotHashProvider.MacData ( string hashAlgorithmId,
ReadOnlySpan< byte > key,
ReadOnlySpan< byte > source,
Span< byte > destination )
inlinestatic

Definition at line 12 of file HashProviderDispenser.cs.

13 {
14 int hashSizeInBytes;
15 if (global::Interop.BCrypt.PseudoHandlesSupported)
16 {
17 HashDataUsingPseudoHandle(hashAlgorithmId, source, key, isHmac: true, destination, out hashSizeInBytes);
18 return hashSizeInBytes;
19 }
20 SafeBCryptAlgorithmHandle cachedBCryptAlgorithmHandle = global::Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle(hashAlgorithmId, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.BCRYPT_ALG_HANDLE_HMAC_FLAG, out hashSizeInBytes);
21 if (destination.Length < hashSizeInBytes)
22 {
23 throw new CryptographicException();
24 }
25 HashUpdateAndFinish(cachedBCryptAlgorithmHandle, hashSizeInBytes, key, source, destination);
26 return hashSizeInBytes;
27 }
static unsafe void HashDataUsingPseudoHandle(string hashAlgorithmId, ReadOnlySpan< byte > source, ReadOnlySpan< byte > key, bool isHmac, Span< byte > destination, out int hashSize)
static void HashUpdateAndFinish(SafeBCryptAlgorithmHandle algHandle, int hashSize, ReadOnlySpan< byte > key, ReadOnlySpan< byte > source, Span< byte > destination)

References System.destination, Internal.Cryptography.HashProviderDispenser.OneShotHashProvider.HashDataUsingPseudoHandle(), Internal.Cryptography.HashProviderDispenser.OneShotHashProvider.HashUpdateAndFinish(), System.key, and System.source.

Referenced by System.Security.Cryptography.HMACMD5.TryHashData(), System.Security.Cryptography.HMACSHA1.TryHashData(), System.Security.Cryptography.HMACSHA256.TryHashData(), System.Security.Cryptography.HMACSHA384.TryHashData(), and System.Security.Cryptography.HMACSHA512.TryHashData().