INNER CODE UNIT · C#
result
sdrapkin/SecurityDriven.Inferno · CryptoRandom.cs:358
var result = Unsafe.As<byte, int>(ref _byteCache[_byteCachePosition]);//BitConverter.ToInt32(_byteCache, _byteCachePosition);
_byteCachePosition += sizeof(int);
return result;
}
BCrypt.NTSTATUS status = BCrypt.BCryptGenRandom(_byteCache, BYTE_CACHE_SIZE);
if (status == BCrypt.NTSTATUS.STATUS_SUCCESS)
{
_byteCachePosition = sizeof(int);
return Unsafe.As<byte, int>(ref _byteCache[0]);//BitConverter.ToInt32(_byteCache, 0);
}
return ThrowNewCryptographicException((int)status);
}// lock
}//GetRandomInt()
/// <summary>
/// Gets one random signed 64bit integer in a thread safe manner.
/// </summary>