feat(hash):完成基本散列算法。
This commit is contained in:
20
tests/hash.rs
Normal file
20
tests/hash.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
#[cfg(test)]
|
||||
mod hash {
|
||||
#[test]
|
||||
fn test_md5() {
|
||||
let hashed_value = rs_toolbox::hash::md5::hash("hello");
|
||||
assert_eq!(hashed_value, "5d41402abc4b2a76b9719d911017c592");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha1() {
|
||||
let hashed_value = rs_toolbox::hash::sha1::hash("hello");
|
||||
assert_eq!(hashed_value, "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sha512() {
|
||||
let hashed_value = rs_toolbox::hash::sha512::hash("hello");
|
||||
assert_eq!(hashed_value, "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user