Crates.io | random_lfsr_256_galois |
lib.rs | random_lfsr_256_galois |
version | 22.10.0 |
source | src |
created_at | 2022-10-25 21:37:40.818894 |
updated_at | 2022-10-25 21:37:40.818894 |
description | Simple random generator imlplementation based on linear feedback shift register (LFSR, Galois variation) on 256-bit polynome |
homepage | |
repository | https://github.com/zavijavasoft/random-lfsr-256-galois |
max_upload_size | |
id | 697257 |
size | 19,341 |
Simple random generator imlplementation based on linear feedback shift register (LFSR, Galois variation) on 256-bit polynome.
random-lfsr-256-galois is minimalistic uniform-distributed pseudo-random number generator, with possibility of distortion of random sequence. It based on 256-bit LFSR polynome x256 + x254 + x251 + x246 and generates extremely more random combinations then standard 32-bit pseudo-random generator.
This implementation developed for educational and entertainment purposes (e.g. games). Do not use it in cryptographic projects, and if you do it for crypto you will get what you deserve.
use random_lfsr_256_galois::LFSRGaloisBuilder;
//Create PRNG with builder
let mut lfsr = LFSRGaloisBuilder::new().build();
// Then get random value of type you need (up to 128bit)
let random_byte: u8 = lfsr.next();
let random_int: i32 = lfsr.next();
let random_uint64: u64 = lfsr.next();
let random_u128: u128 = lfsr.next();
Also you can distort register to break up LFSR sequence by calling [LFSRGalois::shake
] function
at random moments of time, e.g. user actions (mouse clicks, pressing buttons)
or another external events such as receiving network packets.
use random_lfsr_256_galois::LFSRGaloisBuilder;
let mut lfsr = LFSRGaloisBuilder::new().build();
lfsr.shake()
X11