unkeyed.rs 779 B

12345678910111213141516171819202122232425262728
  1. use blake2::{digest::FixedOutput, Blake2bMac512, Blake2sMac256};
  2. use hex_literal::hex;
  3. #[test]
  4. fn blake2s_unkeyed() {
  5. let ctx = Blake2sMac256::new_with_salt_and_personal(None, b"salt", b"persona").unwrap();
  6. assert_eq!(
  7. ctx.finalize_fixed(),
  8. hex!(
  9. "d7de83e2b1fedd9755db747235b7ba4b"
  10. "f9773a16b91c6b241e4b1d926160d9eb"
  11. ),
  12. );
  13. }
  14. #[test]
  15. fn blake2b_unkeyed() {
  16. let ctx = Blake2bMac512::new_with_salt_and_personal(None, b"salt", b"persona").unwrap();
  17. assert_eq!(
  18. ctx.finalize_fixed(),
  19. hex!(
  20. "fa3cd38902ae0602d8f0066f18c579fa"
  21. "e8068074fbe91f9f5774f841f5ab51fe"
  22. "39140ad78d6576f8a0b9f8f4c2642211"
  23. "11c9911d8ba1dbefcd034acdbedb8cde"
  24. ),
  25. );
  26. }