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)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cryptography"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"versioning",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "delete"
|
||||
version = "0.1.0"
|
||||
|
@ -152,6 +159,14 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "messaging"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"process",
|
||||
"versioning",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "no_video"
|
||||
version = "0.1.0"
|
||||
|
@ -177,6 +192,13 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "process"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"versioning",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ps2_keyboard"
|
||||
version = "0.1.0"
|
||||
|
@ -190,18 +212,11 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"versioning",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "randomness_handler"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"cryptography",
|
||||
"versioning",
|
||||
]
|
||||
|
||||
|
|
|
@ -13,8 +13,10 @@ members = [
|
|||
|
||||
"libraries/able_graphics_library",
|
||||
"libraries/clparse",
|
||||
"libraries/cryptography",
|
||||
"libraries/locale-maxima",
|
||||
"libraries/rand",
|
||||
"libraries/messaging",
|
||||
"libraries/process",
|
||||
"libraries/table",
|
||||
"libraries/tar",
|
||||
"libraries/time",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "rand"
|
||||
name = "cryptography"
|
||||
version = "0.1.1"
|
||||
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 versioning::Version;
|
||||
pub const VERSION: Version = Version::new(0, 1, 1);
|
||||
|
||||
pub struct Csprng {
|
||||
state: [u8; 256],
|
||||
dirty: bool,
|
Loading…
Reference in a new issue