From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- third_party/rust/sha2/tests/data/sha224.blb | Bin 0 -> 178 bytes third_party/rust/sha2/tests/data/sha256.blb | Bin 0 -> 190 bytes third_party/rust/sha2/tests/data/sha384.blb | Bin 0 -> 238 bytes third_party/rust/sha2/tests/data/sha512.blb | Bin 0 -> 289 bytes third_party/rust/sha2/tests/data/sha512_224.blb | Bin 0 -> 178 bytes third_party/rust/sha2/tests/data/sha512_256.blb | Bin 0 -> 190 bytes third_party/rust/sha2/tests/mod.rs | 35 ++++++++++++++++++++++++ 7 files changed, 35 insertions(+) create mode 100644 third_party/rust/sha2/tests/data/sha224.blb create mode 100644 third_party/rust/sha2/tests/data/sha256.blb create mode 100644 third_party/rust/sha2/tests/data/sha384.blb create mode 100644 third_party/rust/sha2/tests/data/sha512.blb create mode 100644 third_party/rust/sha2/tests/data/sha512_224.blb create mode 100644 third_party/rust/sha2/tests/data/sha512_256.blb create mode 100644 third_party/rust/sha2/tests/mod.rs (limited to 'third_party/rust/sha2/tests') diff --git a/third_party/rust/sha2/tests/data/sha224.blb b/third_party/rust/sha2/tests/data/sha224.blb new file mode 100644 index 0000000000..69327048a9 Binary files /dev/null and b/third_party/rust/sha2/tests/data/sha224.blb differ diff --git a/third_party/rust/sha2/tests/data/sha256.blb b/third_party/rust/sha2/tests/data/sha256.blb new file mode 100644 index 0000000000..389a125787 Binary files /dev/null and b/third_party/rust/sha2/tests/data/sha256.blb differ diff --git a/third_party/rust/sha2/tests/data/sha384.blb b/third_party/rust/sha2/tests/data/sha384.blb new file mode 100644 index 0000000000..74a151f42d Binary files /dev/null and b/third_party/rust/sha2/tests/data/sha384.blb differ diff --git a/third_party/rust/sha2/tests/data/sha512.blb b/third_party/rust/sha2/tests/data/sha512.blb new file mode 100644 index 0000000000..bb2ec390c1 Binary files /dev/null and b/third_party/rust/sha2/tests/data/sha512.blb differ diff --git a/third_party/rust/sha2/tests/data/sha512_224.blb b/third_party/rust/sha2/tests/data/sha512_224.blb new file mode 100644 index 0000000000..3c3ab8facc Binary files /dev/null and b/third_party/rust/sha2/tests/data/sha512_224.blb differ diff --git a/third_party/rust/sha2/tests/data/sha512_256.blb b/third_party/rust/sha2/tests/data/sha512_256.blb new file mode 100644 index 0000000000..acd380aa0c Binary files /dev/null and b/third_party/rust/sha2/tests/data/sha512_256.blb differ diff --git a/third_party/rust/sha2/tests/mod.rs b/third_party/rust/sha2/tests/mod.rs new file mode 100644 index 0000000000..91df4683b7 --- /dev/null +++ b/third_party/rust/sha2/tests/mod.rs @@ -0,0 +1,35 @@ +use digest::dev::{feed_rand_16mib, fixed_reset_test}; +use digest::new_test; +use hex_literal::hex; +use sha2::{Digest, Sha224, Sha256, Sha384, Sha512, Sha512_224, Sha512_256}; + +new_test!(sha224_main, "sha224", Sha224, fixed_reset_test); +new_test!(sha256_main, "sha256", Sha256, fixed_reset_test); +new_test!(sha512_224_main, "sha512_224", Sha512_224, fixed_reset_test); +new_test!(sha512_256_main, "sha512_256", Sha512_256, fixed_reset_test); +new_test!(sha384_main, "sha384", Sha384, fixed_reset_test); +new_test!(sha512_main, "sha512", Sha512, fixed_reset_test); + +#[test] +fn sha256_rand() { + let mut h = Sha256::new(); + feed_rand_16mib(&mut h); + assert_eq!( + h.finalize()[..], + hex!("45f51fead87328fe837a86f4f1ac0eb15116ab1473adc0423ef86c62eb2320c7")[..] + ); +} + +#[test] +#[rustfmt::skip] +fn sha512_rand() { + let mut h = Sha512::new(); + feed_rand_16mib(&mut h); + assert_eq!( + h.finalize()[..], + hex!(" + 9084d75a7c0721541d737b6171eb465dc9ba08a119a182a8508484aa27a176cd + e7c2103b108393eb024493ced4aac56be6f57222cac41b801f11494886264997 + ")[..] + ); +} -- cgit v1.2.3