mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
07c7214edb
This checks that the protobuf is the right form, also handles uncompressed keys (though you shouldn't be using those any more, should you?) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
12 lines
272 B
C
12 lines
272 B
C
#include "bitcoin_address.h"
|
|
#include "pubkey.h"
|
|
#include <ccan/crypto/sha256/sha256.h>
|
|
|
|
void bitcoin_address(const struct pubkey *key, struct bitcoin_address *addr)
|
|
{
|
|
struct sha256 h;
|
|
|
|
sha256(&h, key->key, pubkey_len(key));
|
|
RIPEMD160(h.u.u8, sizeof(h), addr->addr);
|
|
}
|