forked from AbleOS/ableos_userland
Updates people!
This commit is contained in:
parent
af60db2c48
commit
9dd3d94b71
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -188,7 +188,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"versioning",
|
||||
]
|
||||
|
|
|
@ -8,5 +8,22 @@ pub const VERSION: Version = Version::new(0, 1, 0);
|
|||
fn start() {
|
||||
let mut inner_rng = Csprng::new();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "rand"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#![no_std]
|
||||
|
||||
use core::fmt::Display;
|
||||
|
||||
use versioning::Version;
|
||||
pub const VERSION: Version = Version::new(0, 1, 0);
|
||||
pub const VERSION: Version = Version::new(0, 1, 1);
|
||||
|
||||
pub struct Csprng {
|
||||
state: [u8; 256],
|
||||
|
@ -137,4 +139,10 @@ impl Csprng {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum RandError {}
|
||||
impl Display for RandError {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
write!(f, "{}", self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue