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

◆ TryHashData()

virtual bool System.Security.Cryptography.RSA.TryHashData ( ReadOnlySpan< byte > data,
Span< byte > destination,
HashAlgorithmName hashAlgorithm,
out int bytesWritten )
inlineprotectedvirtualinherited

Reimplemented in System.Security.Cryptography.RSAImplementation.RSACng, and System.Security.Cryptography.RSACng.

Definition at line 116 of file RSA.cs.

117 {
118 byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
119 byte[] array2;
120 try
121 {
122 data.CopyTo(array);
123 array2 = HashData(array, 0, data.Length, hashAlgorithm);
124 }
125 finally
126 {
127 Array.Clear(array, 0, data.Length);
129 }
130 if (destination.Length >= array2.Length)
131 {
132 new ReadOnlySpan<byte>(array2).CopyTo(destination);
133 bytesWritten = array2.Length;
134 return true;
135 }
136 bytesWritten = 0;
137 return false;
138 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
virtual byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
Definition RSA.cs:80
void CopyTo(Span< T > destination)

References System.array, System.Array.Clear(), System.ReadOnlySpan< T >.CopyTo(), System.destination, System.Security.Cryptography.RSA.HashData(), System.ReadOnlySpan< T >.Length, and System.Buffers.ArrayPool< T >.Shared.

Referenced by System.Security.Cryptography.RSA.TrySignData(), and System.Security.Cryptography.RSA.VerifyData().