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

◆ Pbkdf1() [2/2]

static void System.Security.Cryptography.PasswordBasedEncryption.Pbkdf1 ( IncrementalHash hasher,
ReadOnlySpan< byte > password,
ReadOnlySpan< byte > salt,
int iterationCount,
Span< byte > dk )
inlinestaticprivate

Definition at line 603 of file PasswordBasedEncryption.cs.

604 {
605 Span<byte> span = stackalloc byte[20];
606 hasher.AppendData(password);
607 hasher.AppendData(salt);
608 if (!hasher.TryGetHashAndReset(span, out var bytesWritten))
609 {
610 throw new CryptographicException();
611 }
612 span = span.Slice(0, bytesWritten);
613 for (int i = 1; i < iterationCount; i++)
614 {
615 hasher.AppendData(span);
616 if (!hasher.TryGetHashAndReset(span, out bytesWritten) || bytesWritten != span.Length)
617 {
618 throw new CryptographicException();
619 }
620 }
621 span.Slice(0, dk.Length).CopyTo(dk);
622 CryptographicOperations.ZeroMemory(span);
623 }
int Length
Definition Span.cs:70

References System.Security.Cryptography.IncrementalHash.AppendData(), System.Span< T >.Length, System.Span< T >.Slice(), System.Security.Cryptography.IncrementalHash.TryGetHashAndReset(), and System.Security.Cryptography.CryptographicOperations.ZeroMemory().