Exemplo n.º 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");
        }
Exemplo n.º 2
0
 public SecureRandom(byte[] seed) : this(SecureRandom.CreatePrng("SHA1", false))
 {
     this.SetSeed(seed);
 }
Exemplo n.º 3
0
 public SecureRandom() : this(SecureRandom.CreatePrng("SHA256", true))
 {
 }