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