Skip to content

Commit f99027f

Browse files
committed
more namespacing
1 parent f242b08 commit f99027f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

bip32.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

bip32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ int bip32_pubkey_from_privkey(unsigned char* out, const unsigned char* privkey_i
6868
*/
6969
int bip32_fingerprint(const bip32_key* key, uint32_t* out);
7070

71-
void sha256_double(uint8_t *hash, const uint8_t *data, size_t len);
71+
void bip32_sha256_double(uint8_t *hash, const uint8_t *data, size_t len);
7272

73-
void hmac_sha512(
73+
void bip32_hmac_sha512(
7474
unsigned char* hmac_out,
7575
const unsigned char* key,
7676
size_t key_len,

0 commit comments

Comments
 (0)