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

◆ FillDeriveKeyPBKDF2()

static unsafe void Internal.Cryptography.Pbkdf2Implementation.FillDeriveKeyPBKDF2 ( ReadOnlySpan< byte > password,
ReadOnlySpan< byte > salt,
int iterations,
string hashAlgorithmName,
Span< byte > destination )
inlinestaticprivate

Definition at line 137 of file Pbkdf2Implementation.cs.

138 {
139 int hashSizeInBytes;
140 SafeBCryptAlgorithmHandle cachedBCryptAlgorithmHandle = global::Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle(hashAlgorithmName, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.BCRYPT_ALG_HANDLE_HMAC_FLAG, out hashSizeInBytes);
141 fixed (byte* pbPassword = password)
142 {
143 fixed (byte* pbSalt = salt)
144 {
145 fixed (byte* pbDerivedKey = destination)
146 {
147 global::Interop.BCrypt.NTSTATUS nTSTATUS = global::Interop.BCrypt.BCryptDeriveKeyPBKDF2(cachedBCryptAlgorithmHandle, pbPassword, password.Length, pbSalt, salt.Length, (ulong)iterations, pbDerivedKey, destination.Length, 0u);
148 if (nTSTATUS != 0)
149 {
150 throw global::Interop.BCrypt.CreateCryptographicException(nTSTATUS);
151 }
152 }
153 }
154 }
155 }

References System.destination, and System.ReadOnlySpan< T >.Length.

Referenced by Internal.Cryptography.Pbkdf2Implementation.Fill().