mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
introduce ecdsa_get_address_raw
This commit is contained in:
parent
c5d9b2ea2f
commit
df3606dd5e
13
ecdsa.c
13
ecdsa.c
@ -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)
|
||||
|
1
ecdsa.h
1
ecdsa.h
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user