1
0
Fork 0
mirror of https://github.com/eosswedenorg/libantelope synced 2026-06-16 19:50:01 +02:00

include/libeosio/WIF.hpp: Pass ec_privkey_t and ec_pubkey_t as const reference.

This commit is contained in:
Henrik Hautakoski 2023-03-08 17:24:22 +01:00
parent 45c1f2909d
commit 77c93edc13
2 changed files with 4 additions and 4 deletions

View file

@ -32,12 +32,12 @@ namespace libeosio {
/**
* 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.
*/
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.

View file

@ -31,7 +31,7 @@ namespace libeosio {
#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;
// 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));
}
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());
unsigned char buf[EC_PUBKEY_SIZE + CHECKSUM_SIZE];