diff --git a/hashes/src/hmac.rs b/hashes/src/hmac.rs index 2f2bbaff4..4a90cc043 100644 --- a/hashes/src/hmac.rs +++ b/hashes/src/hmac.rs @@ -168,10 +168,10 @@ mod tests { use crate::{sha256, GeneralHash as _, Hash as _, HashEngine, Hmac, HmacEngine}; #[derive(Clone)] - struct Test<'a> { - key: &'a [u8], - input: &'a [u8], - output: &'a [u8], + struct Test { + key: &'static [u8], + input: &'static [u8], + output: [u8; 32], } #[rustfmt::skip] @@ -180,9 +180,9 @@ mod tests { // Sadly the RFC2104 test vectors all use MD5 as their underlying hash function, // which of course this library does not support. Test { - key: &[ 0x0b; 20], - input: &[0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65], - output: &[ + key: &[ 0x0b; 20 ], + input: &[ 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 ], + output: [ 0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b, 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, @@ -197,7 +197,7 @@ mod tests { 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x3f, ], - output: &[ + output: [ 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, @@ -207,7 +207,7 @@ mod tests { Test { key: &[ 0xaa; 20 ], input: &[ 0xdd; 50 ], - output: &[ + output: [ 0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7, 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22, @@ -222,7 +222,7 @@ mod tests { 0x19 ], input: &[ 0xcd; 50 ], - output: &[ + output: [ 0x82, 0x55, 0x8a, 0x38, 0x9a, 0x44, 0x3c, 0x0e, 0xa4, 0xcc, 0x81, 0x98, 0x99, 0xf2, 0x08, 0x3a, 0x85, 0xf0, 0xfa, 0xa3, 0xe5, 0x78, 0xf8, 0x07, @@ -240,7 +240,7 @@ mod tests { 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x46, 0x69, 0x72, 0x73, 0x74, ], - output: &[ + output: [ 0x60, 0xe4, 0x31, 0x59, 0x1e, 0xe0, 0xb6, 0x7f, 0x0d, 0x8a, 0x26, 0xaa, 0xcb, 0xf5, 0xb7, 0x7f, 0x8e, 0x0b, 0xc6, 0x21, 0x37, 0x28, 0xc5, 0x14, @@ -270,7 +270,7 @@ mod tests { 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e, ], - output: &[ + output: [ 0x9b, 0x09, 0xff, 0xa7, 0x1b, 0x94, 0x2f, 0xcb, 0x27, 0x63, 0x5f, 0xbc, 0xd5, 0xb0, 0xe9, 0x44, 0xbf, 0xdc, 0x63, 0x64, 0x4f, 0x07, 0x13, 0x93, @@ -284,7 +284,7 @@ mod tests { engine.input(test.input); let hash = Hmac::::from_engine(engine); assert_eq!(hash.as_ref(), test.output); - assert_eq!(hash.as_byte_array(), test.output); + assert_eq!(hash.to_byte_array(), test.output); } }