Org.BouncyCastle.Security.SecureRandom.NextLong C# (CSharp) Method

NextLong() public method

public NextLong ( ) : long
return long
		public virtual long NextLong()
		{
			return ((long)(uint) NextInt() << 32) | (long)(uint) NextInt();
		}
    }

Usage Example

        /// <summary>
        /// Create an intermediate from a passphrase or intermediate code
        /// </summary>
        public Bip38Intermediate(string fromstring, Interpretation interpretation, int startingSequenceNumber = 0)
        {
            if (interpretation == Interpretation.IntermediateCode) {
                createFromCode(fromstring);
            } else {
                _ownerentropy = new byte[8];

                // Get 8 random bytes to use as salt
                SecureRandom sr = new SecureRandom();
                sr.NextBytes(_ownerentropy);
                // set lot number between 100000 and 999999, and sequence number to 1
                long x = (sr.NextLong () % 900000L + 100000L) * 4096L + (long)startingSequenceNumber;
                for (int i=7; i>=4; i--) {
                    _ownerentropy[i] = (byte)(x & 0xFF);
                    x >>= 8;
                }
                createFromPassphrase(fromstring, _ownerentropy, true);
            }
        }
All Usage Examples Of Org.BouncyCastle.Security.SecureRandom::NextLong