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

◆ HashData()

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

Definition at line 29 of file HashProviderDispenser.cs.

30 {
31 int hashSizeInBytes;
32 if (global::Interop.BCrypt.PseudoHandlesSupported)
33 {
34 HashDataUsingPseudoHandle(hashAlgorithmId, source, default(ReadOnlySpan<byte>), isHmac: false, destination, out hashSizeInBytes);
35 return hashSizeInBytes;
36 }
37 SafeBCryptAlgorithmHandle cachedBCryptAlgorithmHandle = global::Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle(hashAlgorithmId, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None, out hashSizeInBytes);
38 if (destination.Length < hashSizeInBytes)
39 {
40 throw new CryptographicException();
41 }
42 HashUpdateAndFinish(cachedBCryptAlgorithmHandle, hashSizeInBytes, default(ReadOnlySpan<byte>), source, destination);
43 return hashSizeInBytes;
44 }
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(), and System.source.

Referenced by System.Security.Cryptography.MD5.TryHashData(), System.Security.Cryptography.SHA1.TryHashData(), System.Security.Cryptography.SHA256.TryHashData(), System.Security.Cryptography.SHA384.TryHashData(), and System.Security.Cryptography.SHA512.TryHashData().