use digest::dev::{feed_rand_16mib, fixed_reset_test};
use digest::{hash_serialization_test, new_test};
use groestl::{Digest, Groestl224, Groestl256, Groestl384, Groestl512};
use hex_literal::hex;
new_test!(groestl224_kat, Groestl224, fixed_reset_test);
new_test!(groestl256_kat, Groestl256, fixed_reset_test);
new_test!(groestl384_kat, Groestl384, fixed_reset_test);
new_test!(groestl512_kat, Groestl512, fixed_reset_test);
hash_serialization_test!(groestl224_serialization, Groestl224);
hash_serialization_test!(groestl256_serialization, Groestl256);
hash_serialization_test!(groestl384_serialization, Groestl384);
hash_serialization_test!(groestl512_serialization, Groestl512);
#[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]
fn groestl384_rand() {
let mut h = Groestl384::new();
feed_rand_16mib(&mut h);
assert_eq!(
h.finalize(),
hex!(
"dab78eea895a6dde0c53dc02fc79c7986f5d6811618ca6e5922f01e8aca9bfeb"
"20ed5eda4130bf0ab474ac0b6f0290f8"
),
);
}
#[test]
fn groestl512_rand() {
let mut h = Groestl512::new();
feed_rand_16mib(&mut h);
assert_eq!(
h.finalize(),
hex!(
"7e4d8257c217c7ae59331126e0f984f145e9789862de7c099675ac29e46424ef"
"e93543974fa7113190d492f607f629a03db35ec5551abcb2785ae145fd3c543f"
),
);
}