Crate mx3[][src]

Rust implementation of the mx3 algorithm providing a bit mixer, pseudo-random number generator, and hash function.

The crate is not intended for cryptographically secure purposes.

The crate implements revision 2 of the mx3 algorithm.

Examples

Mixing bits

let mixed_bits = mx3::mix(123456789);
println!("{:x}", mixed_bits);

Random number generation

use rand::prelude::*;

let mut rng = mx3::Mx3Rng::new(123456789);
let random_number = rng.gen::<f64>();
println!("{}", random_number);

Hashing

let hash_digest = mx3::hash(b"Hello world!", 123456789);
println!("{:x}", hash_digest);

Structs

Mx3Hasher

Hasher for computing a hash digest of a stream of bytes.

Mx3Rng

Pseudo-random number generator with 64-bits of state and cycle of 2^64.

Functions

hash

Hash the given buffer.

mix

Mix the bits in the integer.