INNER CODE UNIT · C#

BYTE_CACHE_SIZE

sdrapkin/SecurityDriven.Inferno · CryptoRandom.cs:17

		const int BYTE_CACHE_SIZE = 4096; // 4k buffer seems to work best (empirical experimentation). Buffer must be larger than CACHE_THRESHOLD.
		readonly byte[] _byteCache = new byte[BYTE_CACHE_SIZE];
		int _byteCachePosition = BYTE_CACHE_SIZE;

		static CryptoRandom()
		{
			SanityCheck();
		}// static ctor

		public CryptoRandom() : base(Seed: 0)
		{
			// Minimize the wasted time of calling default System.Random base ctor.
			// We can't avoid calling at least some base ctor, ie. 2~3 milliseconds are wasted anyway.
			// That's the price of inheriting from System.Random (doesn't implement an interface).
		}// ctor

		static void SanityCheck()
		{

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…