vibe.d beta banner
get vibe.d
0.7.30

Class HashMixerRNG

Hash-based cryptographically secure random number mixer.

This RNG uses a hash function to mix a specific amount of random bytes from the input RNG. Use only cryptographically secure hash functions like SHA-512, Whirlpool or SHA-256, but not MD5.

Template arguments

class HashMixerRNG(Hash, uint factor)
if (isDigest!Hash);

Inherits from

  • Object (base class)

Constructors

Name Description
this Creates new hash-based mixer random generator.

Fields

Name Type Description
rng SystemRNG

Properties

Name Type Description
dataAvailableForRead [get] bool
empty [get] bool
leastSize [get] ulong

Methods

Name Description
peek
read

Parameters

NameDescription

Hash

The hash function used, for example SHA1

factor

Determines how many times the hash digest length of input data is used as input to the hash function. Increase factor value if you need more security because it increases entropy level or decrease the factor value if you need more speed.

Authors

Ilya Shipunov

Copyright

© 2013 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.