mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-07-03 23:13:40 +02:00
include/libeosio/WIF.hpp: Pass ec_privkey_t and ec_pubkey_t as const reference.
This commit is contained in:
parent
45c1f2909d
commit
77c93edc13
2 changed files with 4 additions and 4 deletions
|
|
@ -32,12 +32,12 @@ namespace libeosio {
|
||||||
/**
|
/**
|
||||||
* Encode an EC private key to WIF String.
|
* Encode an EC private key to WIF String.
|
||||||
*/
|
*/
|
||||||
std::string wif_priv_encode(ec_privkey_t priv);
|
std::string wif_priv_encode(const ec_privkey_t& priv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode an EC public key to WIF String.
|
* Encode an EC public key to WIF String.
|
||||||
*/
|
*/
|
||||||
std::string wif_pub_encode(ec_pubkey_t pub, const std::string& prefix = "EOS");
|
std::string wif_pub_encode(const ec_pubkey_t& pub, const std::string& prefix = "EOS");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints an EC keypair in WIF format to standard out.
|
* Prints an EC keypair in WIF format to standard out.
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace libeosio {
|
||||||
|
|
||||||
#define PRIV_KEY_PREFIX 0x80 /* 0x80 for "Bitcoin mainnet". Always used by EOS. */
|
#define PRIV_KEY_PREFIX 0x80 /* 0x80 for "Bitcoin mainnet". Always used by EOS. */
|
||||||
|
|
||||||
std::string wif_priv_encode(ec_privkey_t priv) {
|
std::string wif_priv_encode(const ec_privkey_t& priv) {
|
||||||
|
|
||||||
checksum_t check;
|
checksum_t check;
|
||||||
// 1 byte extra for prefix.
|
// 1 byte extra for prefix.
|
||||||
|
|
@ -46,7 +46,7 @@ std::string wif_priv_encode(ec_privkey_t priv) {
|
||||||
return base58_encode(buf, buf + sizeof(buf));
|
return base58_encode(buf, buf + sizeof(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string wif_pub_encode(ec_pubkey_t pub, const std::string& prefix) {
|
std::string wif_pub_encode(const ec_pubkey_t& pub, const std::string& prefix) {
|
||||||
|
|
||||||
checksum_t check = checksum_ripemd160(pub.data(), pub.size());
|
checksum_t check = checksum_ripemd160(pub.data(), pub.size());
|
||||||
unsigned char buf[EC_PUBKEY_SIZE + CHECKSUM_SIZE];
|
unsigned char buf[EC_PUBKEY_SIZE + CHECKSUM_SIZE];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue