1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

introduce ecdsa_get_address_raw

This commit is contained in:
Pavol Rusnak 2014-11-16 21:17:39 +01:00
parent c5d9b2ea2f
commit df3606dd5e
2 changed files with 10 additions and 4 deletions

13
ecdsa.c
View File

@ -418,12 +418,17 @@ void ecdsa_get_pubkeyhash(const uint8_t *pub_key, uint8_t *pubkeyhash)
ripemd160(h, 32, pubkeyhash);
}
void ecdsa_get_address_raw(const uint8_t *pub_key, uint8_t version, uint8_t *addr_raw)
{
addr_raw[0] = version;
ecdsa_get_pubkeyhash(pub_key, addr_raw + 1);
}
void ecdsa_get_address(const uint8_t *pub_key, uint8_t version, char *addr)
{
uint8_t data[21];
data[0] = version;
ecdsa_get_pubkeyhash(pub_key, data + 1);
base58_encode_check(data, 21, addr);
uint8_t raw[21];
ecdsa_get_address_raw(pub_key, version, raw);
base58_encode_check(raw, 21, addr);
}
void ecdsa_get_wif(const uint8_t *priv_key, uint8_t version, char *wif)

View File

@ -45,6 +45,7 @@ int ecdsa_sign_digest(const uint8_t *priv_key, const uint8_t *digest, uint8_t *s
void ecdsa_get_public_key33(const uint8_t *priv_key, uint8_t *pub_key);
void ecdsa_get_public_key65(const uint8_t *priv_key, uint8_t *pub_key);
void ecdsa_get_pubkeyhash(const uint8_t *pub_key, uint8_t *pubkeyhash);
void ecdsa_get_address_raw(const uint8_t *pub_key, uint8_t version, uint8_t *addr_raw);
void ecdsa_get_address(const uint8_t *pub_key, uint8_t version, char *addr);
void ecdsa_get_wif(const uint8_t *priv_key, uint8_t version, char *wif);
int ecdsa_address_decode(const char *addr, uint8_t *out);