예제 #1
0
        public static SecureRandom GetInstance(string algorithm, bool autoSeed)
        {
            string text = Platform.ToUpperInvariant(algorithm);

            if (text.EndsWith("PRNG"))
            {
                string digestName = text.Substring(0, text.Length - "PRNG".Length);
                DigestRandomGenerator digestRandomGenerator = SecureRandom.CreatePrng(digestName, autoSeed);
                if (digestRandomGenerator != null)
                {
                    return(new SecureRandom(digestRandomGenerator));
                }
            }
            throw new ArgumentException("Unrecognised PRNG algorithm: " + algorithm, "algorithm");
        }
예제 #2
0
 public SecureRandom(byte[] seed) : this(SecureRandom.CreatePrng("SHA1", false))
 {
     this.SetSeed(seed);
 }
예제 #3
0
 public SecureRandom() : this(SecureRandom.CreatePrng("SHA256", true))
 {
 }