forked from RustCrypto/hashes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.rs
executable file
·57 lines (52 loc) · 1.55 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use digest::dev::{feed_rand_16mib, fixed_reset_test};
use digest::new_test;
use groestl::{Digest, Groestl224, Groestl256, Groestl384, Groestl512};
use hex_literal::hex;
new_test!(groestl_224_main, "groestl224", Groestl224, fixed_reset_test);
new_test!(groestl_256_main, "groestl256", Groestl256, fixed_reset_test);
new_test!(groestl_384_main, "groestl384", Groestl384, fixed_reset_test);
new_test!(groestl_512_main, "groestl512", Groestl512, fixed_reset_test);
#[test]
fn groestl224_rand() {
let mut h = Groestl224::new();
feed_rand_16mib(&mut h);
assert_eq!(
h.finalize()[..],
hex!("2000744c2f85a7fb4733e97da8db00069dd6defa9186dac3461dfeb8")[..]
);
}
#[test]
fn groestl256_rand() {
let mut h = Groestl256::new();
feed_rand_16mib(&mut h);
assert_eq!(
h.finalize()[..],
hex!("aac71c789678f627a6474605322ae98d1647e47f405d00b1461b90ee5f0cfbc4")[..]
);
}
#[test]
#[rustfmt::skip]
fn groestl384_rand() {
let mut h = Groestl384::new();
feed_rand_16mib(&mut h);
assert_eq!(
h.finalize()[..],
hex!("
dab78eea895a6dde0c53dc02fc79c7986f5d6811618ca6e5922f01e8aca9bfeb
20ed5eda4130bf0ab474ac0b6f0290f8
")[..]
);
}
#[test]
#[rustfmt::skip]
fn groestl512_rand() {
let mut h = Groestl512::new();
feed_rand_16mib(&mut h);
assert_eq!(
h.finalize()[..],
hex!("
7e4d8257c217c7ae59331126e0f984f145e9789862de7c099675ac29e46424ef
e93543974fa7113190d492f607f629a03db35ec5551abcb2785ae145fd3c543f
")[..],
);
}