lfsr-fibo

Crates.iolfsr-fibo
lib.rslfsr-fibo
version0.1.0
created_at2025-09-10 09:22:16.979992+00
updated_at2025-09-10 09:22:16.979992+00
descriptionEfficient pure Rust implemention of LFSR using Fibonacci representation.
homepage
repositoryhttps://github.com/acmo0/lfsr-fibo.git
max_upload_size
id1832279
size5,459
(acmo0)

documentation

README

lfsr-fibo

Crates.io Total Downloads Crates.io Version

Efficient pure Rust implementation of LFSR in fibonacci representation.

Please see installation details and doc on crates.io.


Usage

This is an example of a basic usage. Let say that you want to generate 256 bits from the LFSR represented by the polynomial x^11 + x^6 + x^3 + 1 with an initial state of 10101101110, then you can use this crate in the folowing way :

use std::collections::VecDeque;
use lfsr_fibo::Lfsr;

fn main() {
	let mut lfsr = Lfsr::new(vec![11, 6, 3]);
	lfsr.set_key(VecDeque::from([1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0]));

	let mut generated: Vec<u8> = vec![];

	for _i in 0..256 {
		generated.push(lfsr.clock());
	}
	println!("Generated : {:?}", generated);
}
Commit count: 0

cargo fmt