Debian Codegraph @

debian/rust-vendor/sm3/tests/mod.rs

raw
1 use digest::dev::{feed_rand_16mib, fixed_reset_test};
2 use hex_literal::hex;
3 use sm3::{Digest, Sm3};
4
5 digest::new_test!(sm3_kat, Sm3, fixed_reset_test);
6 digest::hash_serialization_test!(sm3_serialization, Sm3);
7
8 #[test]
9 fn sm3_rand() {
10 let mut h = Sm3::new();
11 feed_rand_16mib(&mut h);
12 assert_eq!(
13 h.finalize(),
14 hex!("ad154967b08d636a148dd4c688a6df7add1ed1946af18eb358a9b320de2aca86"),
15 );
16 }
17
18 #[cfg(feature = "oid")]
19 #[test]
20 fn sm3_oid() {
21 use sm3::digest::const_oid::{AssociatedOid, ObjectIdentifier};
22 assert_eq!(
23 Sm3::OID,
24 ObjectIdentifier::new_unwrap("1.2.156.10197.1.401")
25 );
26 }