Cryptography/CafeLib.Cryptography/Randomizer.cs
/// <summary>
/// Centralized source of a cryptographic strong random entropy.
/// </summary>
/// <param name="length">How many bytes.</param>
Centralized source of a cryptographic strong random entropy.
Centralized source of a cryptographic strong random entropy .
public static byte[] GetStrongRandBytes(int length)
        {
            var buf = new byte[length];
            var rng = new DigestRandomGenerator(new Sha256Digest());
            rng.AddSeedMaterial(NextCounterValue());
            rng.AddSeedMaterial(new Guid().ToByteArray());
            rng.NextBytes(buf);
            return buf;
        }
public static byte [ ] GetStrongRandBytes ( int length ) { var buf = new byte [ length ] ; var rng = new DigestRandomGenerator ( new Sha256Digest ( ) ) ; rng . AddSeedMaterial ( NextCounterValue ( ) ) ; rng . AddSeedMaterial ( new Guid ( ) . ToByteArray ( ) ) ; rng . NextBytes ( buf ) ; return buf ; }
Centralized source of a cryptographic strong random entropy.
Centralized source of a cryptographic strong random entropy .
length
int
None