@@ -52,7 +52,7 @@ pub(crate) struct OnionKeys {
5252#[ inline]
5353pub ( crate ) fn gen_rho_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
5454 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" ) ;
5656 hmac. input ( & shared_secret) ;
5757 Hmac :: from_engine ( hmac) . to_byte_array ( )
5858}
@@ -74,15 +74,15 @@ pub(crate) fn gen_rho_mu_from_shared_secret(shared_secret: &[u8]) -> ([u8; 32],
7474#[ inline]
7575pub ( super ) fn gen_um_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
7676 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" ) ;
7878 hmac. input ( & shared_secret) ;
7979 Hmac :: from_engine ( hmac) . to_byte_array ( )
8080}
8181
8282#[ inline]
8383pub ( super ) fn gen_ammag_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
8484 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" ) ;
8686 hmac. input ( & shared_secret) ;
8787 Hmac :: from_engine ( hmac) . to_byte_array ( )
8888}
@@ -91,7 +91,7 @@ pub(super) fn gen_ammag_from_shared_secret(shared_secret: &[u8]) -> [u8; 32] {
9191#[ inline]
9292pub ( super ) fn gen_pad_from_shared_secret ( shared_secret : & [ u8 ] ) -> [ u8 ; 32 ] {
9393 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" ) ;
9595 hmac. input ( & shared_secret) ;
9696 Hmac :: from_engine ( hmac) . to_byte_array ( )
9797}
0 commit comments