@@ -49,7 +49,7 @@ int bip32_from_seed(bip32_key *key, const unsigned char *seed, size_t seed_len)
4949    unsigned char   output [crypto_auth_hmacsha512_BYTES ];
5050    const  unsigned char   bitcoin_seed [] =  "Bitcoin seed" ;
5151
52-     hmac_sha512 (output , bitcoin_seed , strlen ((char * )bitcoin_seed ), seed , seed_len );
52+     bip32_hmac_sha512 (output , bitcoin_seed , strlen ((char * )bitcoin_seed ), seed , seed_len );
5353
5454    secp256k1_context *  ctx  =  NULL ;
5555    get_secp_ctx (& ctx );
@@ -158,7 +158,7 @@ int bip32_index_derive(bip32_key *target, const bip32_key *source, uint32_t inde
158158    uint32_t  bigindex  =  to_big_endian (index );
159159    memcpy (hmac_msg  +  BIP32_PUBKEY_SIZE , & bigindex , sizeof (uint32_t ));
160160
161-     hmac_sha512 (output , source -> chain_code , BIP32_CHAINCODE_SIZE , hmac_msg , hmac_msg_len );
161+     bip32_hmac_sha512 (output , source -> chain_code , BIP32_CHAINCODE_SIZE , hmac_msg , hmac_msg_len );
162162
163163    memcpy (target -> chain_code , output  +  BIP32_PRIVKEY_SIZE , BIP32_CHAINCODE_SIZE );
164164
@@ -320,7 +320,7 @@ int bip32_serialize(const bip32_key *key, char *str, size_t str_len) {
320320
321321    // Add checksum and base58 encode 
322322    uint8_t  hash [32 ];
323-     sha256_double (hash , data , 78 );
323+     bip32_sha256_double (hash , data , 78 );
324324    memcpy (data  +  SER_SIZE , hash , 4 );
325325
326326    return  b58enc (str , & str_len , data , SER_PLUS_CHECKSUM_SIZE );
@@ -338,7 +338,7 @@ int bip32_deserialize(bip32_key *key, const char *str, const size_t str_len) {
338338
339339    // Verify checksum 
340340    unsigned char   hash [crypto_hash_sha512_BYTES ];
341-     sha256_double (hash , data , 78 );
341+     bip32_sha256_double (hash , data , 78 );
342342    if  (memcmp (hash , data  +  78 , 4 ) !=  0 ) {
343343        return  0 ;
344344    }
@@ -425,14 +425,14 @@ int bip32_get_public(bip32_key *target, const bip32_key *source) {
425425    return  1 ;
426426}
427427
428- void  sha256_double (uint8_t  * hash , const  uint8_t  * data , size_t  len ) {
428+ void  bip32_sha256_double (uint8_t  * hash , const  uint8_t  * data , size_t  len ) {
429429    assert (sodium_init () >= 0 );
430430    unsigned char   inthash [crypto_hash_sha256_BYTES ];
431431    sha256 (inthash , data , len );
432432    sha256 (hash , inthash , crypto_hash_sha256_BYTES );
433433}
434434
435- void  hmac_sha512 (
435+ void  bip32_hmac_sha512 (
436436    unsigned char  *  hmac_out , 
437437    const  unsigned char  *  key , 
438438    size_t  key_len , 
0 commit comments