C# Class TwoFactorAuthNet.Providers.Rng.HashRngProvider

Provides a non-cryptographically secure RNG provider.
The PrngProvider is based on a simple PRNG and iteratively (re)hashed values.
Inheritance: IRngProvider
Show file Open project: RobThree/TwoFactorAuth.Net

Public Methods

Method Description
GetRandomBytes ( int bytes ) : byte[]

Fills an array of bytes with a sequence of random values.

HashRngProvider ( ) : System

Initializes a new instance of the HashRngProvider.

Uses SHA256 by default to generate random values.

HashRngProvider ( HashAlgorithm algorithm ) : System

Initializes a new instance of the HashRngProvider with a specified HashAlgorithm.

Method Details

GetRandomBytes() public method

Fills an array of bytes with a sequence of random values.
public GetRandomBytes ( int bytes ) : byte[]
bytes int The desired number of bytes to return.
return byte[]

HashRngProvider() public method

Initializes a new instance of the HashRngProvider.
Uses SHA256 by default to generate random values.
public HashRngProvider ( ) : System
return System

HashRngProvider() public method

Initializes a new instance of the HashRngProvider with a specified HashAlgorithm.
Thrown when is null.
public HashRngProvider ( HashAlgorithm algorithm ) : System
algorithm System.Security.Cryptography.HashAlgorithm The to use when generating random number sequences.
return System