templating...
This commit is contained in:
@@ -1,13 +1,20 @@
|
|||||||
|
mod blake256;
|
||||||
|
mod crc32;
|
||||||
|
mod md5;
|
||||||
mod null_hash;
|
mod null_hash;
|
||||||
|
mod sha1;
|
||||||
|
mod sha256;
|
||||||
|
mod sha3_256;
|
||||||
|
|
||||||
use crate::Args;
|
use crate::Args;
|
||||||
|
|
||||||
use md5::digest;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
type BITS256 = [u8; 32];
|
type BITS256 = [u8; 32];
|
||||||
type BITS160 = [u8; 20];
|
type BITS160 = [u8; 20];
|
||||||
|
|
||||||
|
type BITS128 = [u8; 16];
|
||||||
|
|
||||||
type BITS32 = u32;
|
type BITS32 = u32;
|
||||||
|
|
||||||
type ArcU8 = Arc<[u8]>;
|
type ArcU8 = Arc<[u8]>;
|
||||||
@@ -29,6 +36,7 @@ pub enum HashReturn {
|
|||||||
SHA3_256(BITS256),
|
SHA3_256(BITS256),
|
||||||
BLAKE256(BITS256),
|
BLAKE256(BITS256),
|
||||||
SHA1(BITS160),
|
SHA1(BITS160),
|
||||||
|
MD5(BITS128),
|
||||||
RAW(ArcU8),
|
RAW(ArcU8),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +48,7 @@ impl HashReturn {
|
|||||||
HashReturn::SHA3_256(inner) => Arc::new(inner),
|
HashReturn::SHA3_256(inner) => Arc::new(inner),
|
||||||
HashReturn::BLAKE256(inner) => Arc::new(inner),
|
HashReturn::BLAKE256(inner) => Arc::new(inner),
|
||||||
HashReturn::SHA1(inner) => Arc::new(inner),
|
HashReturn::SHA1(inner) => Arc::new(inner),
|
||||||
|
HashReturn::MD5(inner) => Arc::new(inner),
|
||||||
HashReturn::RAW(inner) => inner,
|
HashReturn::RAW(inner) => inner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
src/hashes/blake256.rs
Normal file
0
src/hashes/blake256.rs
Normal file
0
src/hashes/crc32.rs
Normal file
0
src/hashes/crc32.rs
Normal file
29
src/hashes/md5.rs
Normal file
29
src/hashes/md5.rs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub struct MD5 {
|
||||||
|
hash: BITS128,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Hasher for MD5 {
|
||||||
|
fn new() -> Self {
|
||||||
|
MD5 { hash: [0; 16] }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn digest(&mut self, bytes: impl AsRef<[u8]>) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn complete(self) -> HashReturn {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_md5_hash() {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/hashes/sha1.rs
Normal file
0
src/hashes/sha1.rs
Normal file
0
src/hashes/sha256.rs
Normal file
0
src/hashes/sha256.rs
Normal file
0
src/hashes/sha3_256.rs
Normal file
0
src/hashes/sha3_256.rs
Normal file
Reference in New Issue
Block a user