vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Class HashMixerRNG

Hash-based cryptographically secure random number mixer.

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

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.

Constructors

NameDescription
this () Creates new hash-based mixer random generator.

Fields

NameTypeDescription
rng SystemRNG

Properties

NameTypeDescription
dataAvailableForRead[get] bool
empty[get] bool
leastSize[get] ulong

Methods

NameDescription
peek ()
read (buffer, mode)

Aliases

NameDescription
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 Sönke Ludwig

License

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