@@ -52,7 +52,7 @@ pub(crate) struct OnionKeys {
52
52
#[ inline]
53
53
pub ( crate ) fn gen_rho_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
54
54
assert_eq ! ( shared_secret. len( ) , 32 ) ;
55
- let mut hmac = HmacEngine :: < Sha256 > :: new ( & [ 0x72 , 0x68 , 0x6f ] ) ; // rho
55
+ let mut hmac = HmacEngine :: < Sha256 > :: new ( b"rho" ) ;
56
56
hmac. input ( & shared_secret) ;
57
57
Hmac :: from_engine ( hmac) . to_byte_array ( )
58
58
}
@@ -74,15 +74,15 @@ pub(crate) fn gen_rho_mu_from_shared_secret(shared_secret: &[u8]) -> ([u8; 32],
74
74
#[ inline]
75
75
pub ( super ) fn gen_um_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
76
76
assert_eq ! ( shared_secret. len( ) , 32 ) ;
77
- let mut hmac = HmacEngine :: < Sha256 > :: new ( & [ 0x75 , 0x6d ] ) ; // um
77
+ let mut hmac = HmacEngine :: < Sha256 > :: new ( b"um" ) ;
78
78
hmac. input ( & shared_secret) ;
79
79
Hmac :: from_engine ( hmac) . to_byte_array ( )
80
80
}
81
81
82
82
#[ inline]
83
83
pub ( super ) fn gen_ammag_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
84
84
assert_eq ! ( shared_secret. len( ) , 32 ) ;
85
- let mut hmac = HmacEngine :: < Sha256 > :: new ( & [ 0x61 , 0x6d , 0x6d , 0x61 , 0x67 ] ) ; // ammag
85
+ let mut hmac = HmacEngine :: < Sha256 > :: new ( b"ammag" ) ;
86
86
hmac. input ( & shared_secret) ;
87
87
Hmac :: from_engine ( hmac) . to_byte_array ( )
88
88
}
@@ -91,7 +91,7 @@ pub(super) fn gen_ammag_from_shared_secret(shared_secret: &[u8]) -> [u8; 32] {
91
91
#[ inline]
92
92
pub ( super ) fn gen_pad_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
93
93
assert_eq ! ( shared_secret. len( ) , 32 ) ;
94
- let mut hmac = HmacEngine :: < Sha256 > :: new ( & [ 0x70 , 0x61 , 0x64 ] ) ; // pad
94
+ let mut hmac = HmacEngine :: < Sha256 > :: new ( b"pad" ) ;
95
95
hmac. input ( & shared_secret) ;
96
96
Hmac :: from_engine ( hmac) . to_byte_array ( )
97
97
}
0 commit comments