GetSeed() public static method

public static GetSeed ( int length ) : byte[]
length int
return byte[]
コード例 #1
0
        private static DigestRandomGenerator CreatePrng(string digestName, bool autoSeed)
        {
            IDigest digest = DigestUtilities.GetDigest(digestName);

            if (digest == null)
            {
                return(null);
            }
            DigestRandomGenerator digestRandomGenerator = new DigestRandomGenerator(digest);

            if (autoSeed)
            {
                digestRandomGenerator.AddSeedMaterial(SecureRandom.NextCounterValue());
                digestRandomGenerator.AddSeedMaterial(SecureRandom.GetSeed(digest.GetDigestSize()));
            }
            return(digestRandomGenerator);
        }