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

◆ TryHashData()

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

Reimplemented in System.Security.Cryptography.ECDsaImplementation.ECDsaCng, and System.Security.Cryptography.ECDsaCng.

Definition at line 448 of file ECDsa.cs.

449 {
450 byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
451 bool flag = false;
452 try
453 {
454 data.CopyTo(array);
455 byte[] array2 = HashData(array, 0, data.Length, hashAlgorithm);
456 flag = true;
457 if (array2.Length <= destination.Length)
458 {
459 new ReadOnlySpan<byte>(array2).CopyTo(destination);
460 bytesWritten = array2.Length;
461 return true;
462 }
463 bytesWritten = 0;
464 return false;
465 }
466 finally
467 {
468 Array.Clear(array, 0, data.Length);
469 if (flag)
470 {
472 }
473 }
474 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
virtual byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
Definition ECDsa.cs:438
void CopyTo(Span< T > destination)

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

Referenced by System.Security.Cryptography.ECDsa.HashSpanToTmp(), and System.Security.Cryptography.ECDsa.VerifyDataCore().