forked from AbleOS/ableos_userland
remove rand and replace with general cryptography
This commit is contained in:
parent
92fdf7c42c
commit
d696b236ec
31
Cargo.lock
generated
31
Cargo.lock
generated
|
@ -68,6 +68,13 @@ dependencies = [
|
||||||
"toml 0.5.9 (git+https://git.ablecorp.us/theoddgarlic/toml-rs)",
|
"toml 0.5.9 (git+https://git.ablecorp.us/theoddgarlic/toml-rs)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cryptography"
|
||||||
|
version = "0.1.1"
|
||||||
|
dependencies = [
|
||||||
|
"versioning",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "delete"
|
name = "delete"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -152,6 +159,14 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "messaging"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"process",
|
||||||
|
"versioning",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "no_video"
|
name = "no_video"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -177,6 +192,13 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "process"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"versioning",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ps2_keyboard"
|
name = "ps2_keyboard"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -190,18 +212,11 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.1.1"
|
|
||||||
dependencies = [
|
|
||||||
"versioning",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "randomness_handler"
|
name = "randomness_handler"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand",
|
"cryptography",
|
||||||
"versioning",
|
"versioning",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,10 @@ members = [
|
||||||
|
|
||||||
"libraries/able_graphics_library",
|
"libraries/able_graphics_library",
|
||||||
"libraries/clparse",
|
"libraries/clparse",
|
||||||
|
"libraries/cryptography",
|
||||||
"libraries/locale-maxima",
|
"libraries/locale-maxima",
|
||||||
"libraries/rand",
|
"libraries/messaging",
|
||||||
|
"libraries/process",
|
||||||
"libraries/table",
|
"libraries/table",
|
||||||
"libraries/tar",
|
"libraries/tar",
|
||||||
"libraries/time",
|
"libraries/time",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rand"
|
name = "cryptography"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
10
libraries/cryptography/src/hashing/mod.rs
Normal file
10
libraries/cryptography/src/hashing/mod.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
pub fn checksum<T: AsRef<[u8]>>(input: T) -> u64 {
|
||||||
|
let input_bytes = input.as_ref();
|
||||||
|
|
||||||
|
let mut checksum: u64 = 0;
|
||||||
|
for &byte in input_bytes {
|
||||||
|
checksum = checksum.wrapping_add(byte as u64);
|
||||||
|
}
|
||||||
|
|
||||||
|
checksum
|
||||||
|
}
|
6
libraries/cryptography/src/lib.rs
Normal file
6
libraries/cryptography/src/lib.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
|
pub mod random;
|
||||||
|
|
||||||
|
use versioning::Version;
|
||||||
|
pub const VERSION: Version = Version::new(0, 1, 1);
|
|
@ -1,10 +1,5 @@
|
||||||
#![no_std]
|
|
||||||
|
|
||||||
use core::fmt::Display;
|
use core::fmt::Display;
|
||||||
|
|
||||||
use versioning::Version;
|
|
||||||
pub const VERSION: Version = Version::new(0, 1, 1);
|
|
||||||
|
|
||||||
pub struct Csprng {
|
pub struct Csprng {
|
||||||
state: [u8; 256],
|
state: [u8; 256],
|
||||||
dirty: bool,
|
dirty: bool,
|
Loading…
Reference in a new issue