Updates people!

This commit is contained in:
Able 2022-12-05 04:04:54 -06:00
parent af60db2c48
commit 9dd3d94b71
4 changed files with 29 additions and 4 deletions

2
Cargo.lock generated
View file

@ -188,7 +188,7 @@ dependencies = [
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"versioning", "versioning",
] ]

View file

@ -8,5 +8,22 @@ pub const VERSION: Version = Version::new(0, 1, 0);
fn start() { fn start() {
let mut inner_rng = Csprng::new(); let mut inner_rng = Csprng::new();
inner_rng.mix_in_data(&[8, 9, 10, 23, 2, 3]); inner_rng.mix_in_data(&[8, 9, 10, 23, 2, 3]);
let _ran_u8 = inner_rng.get_random_u8();
// Request PCI IDS and mixin
let pci_id_data = [8, 12];
inner_rng.mix_in_data(&pci_id_data);
let rand_bytes = inner_rng.get_random_u128().unwrap();
inner_rng.mix_in_data(&rand_bytes.to_le_bytes());
// Loop driver forever
loop {
// Request Mouse XY
let mouse_x_y = [12, 12];
inner_rng.mix_in_data(&mouse_x_y);
// Request the last keypress
let key_press = [7];
inner_rng.mix_in_data(&key_press);
}
} }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "rand" name = "rand"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,7 +1,9 @@
#![no_std] #![no_std]
use core::fmt::Display;
use versioning::Version; use versioning::Version;
pub const VERSION: Version = Version::new(0, 1, 0); pub const VERSION: Version = Version::new(0, 1, 1);
pub struct Csprng { pub struct Csprng {
state: [u8; 256], state: [u8; 256],
@ -137,4 +139,10 @@ impl Csprng {
} }
} }
#[derive(Debug)]
pub enum RandError {} pub enum RandError {}
impl Display for RandError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self)
}
}