INNER CODE UNIT · C#

result

sdrapkin/SecurityDriven.Inferno · CryptoRandom.cs:382

					var result = Unsafe.As<byte, long>(ref _byteCache[_byteCachePosition]);//BitConverter.ToInt64(_byteCache, _byteCachePosition);
					_byteCachePosition += sizeof(long);
					return result;
				}

				BCrypt.NTSTATUS status = BCrypt.BCryptGenRandom(_byteCache, BYTE_CACHE_SIZE);
				if (status == BCrypt.NTSTATUS.STATUS_SUCCESS)
				{
					_byteCachePosition = sizeof(long);
					return Unsafe.As<byte, long>(ref _byteCache[0]);//BitConverter.ToInt64(_byteCache, 0);
				}
				return ThrowNewCryptographicException((int)status);
			}// lock
		}//GetRandomLong()

		static int ThrowNewCryptographicException(int hr) => throw new CryptographicException(hr);
		static void ThrowNewCryptographicException(string message) => throw new CryptographicException(message);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…