From bb7570f85b10cb3bb5f0a4f63ef5304a68f4438d Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Fri, 25 Nov 2016 18:18:48 +0300 Subject: [PATCH] test_siphash24 --- crypto/src/lib.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crypto/src/lib.rs b/crypto/src/lib.rs index 7ea534b8..5fed6d43 100644 --- a/crypto/src/lib.rs +++ b/crypto/src/lib.rs @@ -168,7 +168,7 @@ pub fn checksum(data: &[u8]) -> H32 { #[cfg(test)] mod tests { use primitives::bytes::Bytes; - use super::{ripemd160, sha1, sha256, dhash160, dhash256, checksum}; + use super::{ripemd160, sha1, sha256, dhash160, dhash256, siphash24, checksum}; #[test] fn test_ripemd160() { @@ -203,12 +203,19 @@ mod tests { assert_eq!(result, expected); } - #[test] - fn test_dhash256() { + #[test] + fn test_dhash256() { let expected = "9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50".into(); let result = dhash256(b"hello"); assert_eq!(result, expected); - } + } + + #[test] + fn test_siphash24() { + let expected = 0x74f839c593dc67fd_u64; + let result = siphash24(0x0706050403020100_u64, 0x0F0E0D0C0B0A0908_u64, &[0; 1]); + assert_eq!(result, expected); + } #[test] fn test_checksum() {