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

◆ Func()

void System.Security.Cryptography.Rfc2898DeriveBytes.Func ( )
inlineprivate

Definition at line 258 of file Rfc2898DeriveBytes.cs.

259 {
260 if (_block == uint.MaxValue)
261 {
262 throw new CryptographicException(System.SR.Cryptography_ExceedKdfExtractLimit);
263 }
264 BinaryPrimitives.WriteUInt32BigEndian(_salt.AsSpan(_salt.Length - 4), _block + 1);
265 Span<byte> span = stackalloc byte[64];
266 span = span.Slice(0, _blockSize);
267 if (!_hmac.TryComputeHash(_salt, span, out var bytesWritten) || bytesWritten != _blockSize)
268 {
269 throw new CryptographicException();
270 }
271 span.CopyTo(_buffer);
272 for (int i = 2; i <= _iterations; i++)
273 {
274 if (!_hmac.TryComputeHash(span, span, out bytesWritten) || bytesWritten != _blockSize)
275 {
276 throw new CryptographicException();
277 }
278 for (int num = _buffer.Length - 1; num >= 0; num--)
279 {
280 _buffer[num] ^= span[num];
281 }
282 }
283 _block++;
284 }
static void WriteUInt32BigEndian(Span< byte > destination, uint value)
static string Cryptography_ExceedKdfExtractLimit
Definition SR.cs:174
Definition SR.cs:7
bool TryComputeHash(ReadOnlySpan< byte > source, Span< byte > destination, out int bytesWritten)

References System.Security.Cryptography.Rfc2898DeriveBytes._block, System.Security.Cryptography.Rfc2898DeriveBytes._blockSize, System.Security.Cryptography.Rfc2898DeriveBytes._buffer, System.Security.Cryptography.Rfc2898DeriveBytes._hmac, System.Security.Cryptography.Rfc2898DeriveBytes._iterations, System.Security.Cryptography.Rfc2898DeriveBytes._salt, System.Span< T >.CopyTo(), System.SR.Cryptography_ExceedKdfExtractLimit, System.Span< T >.Slice(), System.Security.Cryptography.HashAlgorithm.TryComputeHash(), and System.Buffers.Binary.BinaryPrimitives.WriteUInt32BigEndian().

Referenced by System.Security.Cryptography.Rfc2898DeriveBytes.GetBytes().