mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-06-17 20:10:03 +02:00
Change namespace and header guards from libeosio to libantelope
This commit is contained in:
parent
0cfd459c71
commit
6824a2f49e
32 changed files with 176 additions and 176 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -8,7 +8,7 @@ TEST_CASE("WIF::wif_priv_decode [legacy]") {
|
|||
struct testcase {
|
||||
std::string name;
|
||||
std::string key;
|
||||
libeosio::ec_privkey_t expected;
|
||||
libantelope::ec_privkey_t expected;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -22,9 +22,9 @@ TEST_CASE("WIF::wif_priv_decode [legacy]") {
|
|||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
|
||||
libeosio::ec_privkey_t result;
|
||||
libantelope::ec_privkey_t result;
|
||||
|
||||
CHECK( libeosio::wif_priv_decode(result, it->key) );
|
||||
CHECK( libantelope::wif_priv_decode(result, it->key) );
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ TEST_CASE("WIF::wif_priv_decode [K1]") {
|
|||
struct testcase {
|
||||
std::string name;
|
||||
std::string key;
|
||||
libeosio::ec_privkey_t expected;
|
||||
libantelope::ec_privkey_t expected;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -49,9 +49,9 @@ TEST_CASE("WIF::wif_priv_decode [K1]") {
|
|||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
|
||||
libeosio::ec_privkey_t result;
|
||||
libantelope::ec_privkey_t result;
|
||||
|
||||
CHECK( libeosio::wif_priv_decode(result, it->key) );
|
||||
CHECK( libantelope::wif_priv_decode(result, it->key) );
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -9,20 +9,20 @@ TEST_CASE("WIF::wif_priv_encode [Legacy]") {
|
|||
struct testcase {
|
||||
std::string name;
|
||||
const std::string prefix;
|
||||
libeosio::ec_privkey_t key;
|
||||
libantelope::ec_privkey_t key;
|
||||
std::string expected;
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests {
|
||||
{ "one", libeosio::WIF_PVT_LEG, { 0x0C, 0x28, 0xFC, 0xA3, 0x86, 0xC7, 0xA2, 0x27, 0x60, 0x0B, 0x2F, 0xE5, 0x0B, 0x7C, 0xAE, 0x11, 0xEC, 0x86, 0xD3, 0xBF, 0x1F, 0xBE, 0x47, 0x1B, 0xE8, 0x98, 0x27, 0xE1, 0x9D,0x72,0xAA,0x1D}, "5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ" },
|
||||
{ "two", libeosio::WIF_PVT_LEG, { 0x9F, 0xE3, 0xE3, 0x2B, 0x3C, 0x4B, 0x6B, 0x91, 0x6E, 0x20, 0x6C, 0xB0, 0x91, 0xDF, 0x1F, 0x5E, 0x34, 0x32, 0x88, 0x0B, 0x41, 0x33, 0x86, 0xBD, 0xF2, 0x92, 0xFF, 0x23, 0x06, 0x43, 0xF2, 0x8C}, "5K2hm8apqz281ANDQdtVzifpxcXFTqG5E7Fc6Q5V2ssqPRQ3urJ" },
|
||||
{ "three", libeosio::WIF_PVT_LEG, { 0x59, 0x3A, 0x51, 0xB5, 0x5D, 0x56, 0xAA, 0xF0, 0x5B, 0xD9, 0xD1, 0x0E, 0x6B, 0x88, 0x6D, 0xF9, 0xC4, 0x37, 0x09, 0xB2, 0x4C, 0xEC, 0xBB, 0x63, 0x68, 0x92, 0xC2, 0x94, 0x31, 0x48, 0x71, 0x8C}, "5JVanYq9HPvuKgr2FjATYB9NvTsJ4a3CAj5oPYKbr1Ja5MRLsZX" }
|
||||
{ "one", libantelope::WIF_PVT_LEG, { 0x0C, 0x28, 0xFC, 0xA3, 0x86, 0xC7, 0xA2, 0x27, 0x60, 0x0B, 0x2F, 0xE5, 0x0B, 0x7C, 0xAE, 0x11, 0xEC, 0x86, 0xD3, 0xBF, 0x1F, 0xBE, 0x47, 0x1B, 0xE8, 0x98, 0x27, 0xE1, 0x9D,0x72,0xAA,0x1D}, "5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ" },
|
||||
{ "two", libantelope::WIF_PVT_LEG, { 0x9F, 0xE3, 0xE3, 0x2B, 0x3C, 0x4B, 0x6B, 0x91, 0x6E, 0x20, 0x6C, 0xB0, 0x91, 0xDF, 0x1F, 0x5E, 0x34, 0x32, 0x88, 0x0B, 0x41, 0x33, 0x86, 0xBD, 0xF2, 0x92, 0xFF, 0x23, 0x06, 0x43, 0xF2, 0x8C}, "5K2hm8apqz281ANDQdtVzifpxcXFTqG5E7Fc6Q5V2ssqPRQ3urJ" },
|
||||
{ "three", libantelope::WIF_PVT_LEG, { 0x59, 0x3A, 0x51, 0xB5, 0x5D, 0x56, 0xAA, 0xF0, 0x5B, 0xD9, 0xD1, 0x0E, 0x6B, 0x88, 0x6D, 0xF9, 0xC4, 0x37, 0x09, 0xB2, 0x4C, 0xEC, 0xBB, 0x63, 0x68, 0x92, 0xC2, 0x94, 0x31, 0x48, 0x71, 0x8C}, "5JVanYq9HPvuKgr2FjATYB9NvTsJ4a3CAj5oPYKbr1Ja5MRLsZX" }
|
||||
};
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
CHECK( libeosio::wif_priv_encode(it->key, it->prefix) == it->expected );
|
||||
CHECK( libantelope::wif_priv_encode(it->key, it->prefix) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,20 +32,20 @@ TEST_CASE("WIF::wif_priv_encode [K1]") {
|
|||
struct testcase {
|
||||
std::string name;
|
||||
const std::string prefix;
|
||||
libeosio::ec_privkey_t key;
|
||||
libantelope::ec_privkey_t key;
|
||||
std::string expected;
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests {
|
||||
{ "one", libeosio::WIF_PVT_K1, { 0x0C, 0x28, 0xFC, 0xA3, 0x86, 0xC7, 0xA2, 0x27, 0x60, 0x0B, 0x2F, 0xE5, 0x0B, 0x7C, 0xAE, 0x11, 0xEC, 0x86, 0xD3, 0xBF, 0x1F, 0xBE, 0x47, 0x1B, 0xE8, 0x98, 0x27, 0xE1, 0x9D,0x72,0xAA,0x1D}, "PVT_K1_6Mcb23muAxyXaSMhmB6B1mqkvLdWhtuFZmnZsxDczHRvQdp32" },
|
||||
{ "two", libeosio::WIF_PVT_K1, { 0x9F, 0xE3, 0xE3, 0x2B, 0x3C, 0x4B, 0x6B, 0x91, 0x6E, 0x20, 0x6C, 0xB0, 0x91, 0xDF, 0x1F, 0x5E, 0x34, 0x32, 0x88, 0x0B, 0x41, 0x33, 0x86, 0xBD, 0xF2, 0x92, 0xFF, 0x23, 0x06, 0x43, 0xF2, 0x8C}, "PVT_K1_2DRBT8jmXT8k9ywNSSbufvhk1hLFhPzWJBpsE2jo12CDoFhcc1" },
|
||||
{ "three", libeosio::WIF_PVT_K1, { 0x59, 0x3A, 0x51, 0xB5, 0x5D, 0x56, 0xAA, 0xF0, 0x5B, 0xD9, 0xD1, 0x0E, 0x6B, 0x88, 0x6D, 0xF9, 0xC4, 0x37, 0x09, 0xB2, 0x4C, 0xEC, 0xBB, 0x63, 0x68, 0x92, 0xC2, 0x94, 0x31, 0x48, 0x71, 0x8C}, "PVT_K1_gJCsP4CwMv4gTkDXiZT8QFhs3NrSB7Sv22ANGrc8Svun9uC9C" }
|
||||
{ "one", libantelope::WIF_PVT_K1, { 0x0C, 0x28, 0xFC, 0xA3, 0x86, 0xC7, 0xA2, 0x27, 0x60, 0x0B, 0x2F, 0xE5, 0x0B, 0x7C, 0xAE, 0x11, 0xEC, 0x86, 0xD3, 0xBF, 0x1F, 0xBE, 0x47, 0x1B, 0xE8, 0x98, 0x27, 0xE1, 0x9D,0x72,0xAA,0x1D}, "PVT_K1_6Mcb23muAxyXaSMhmB6B1mqkvLdWhtuFZmnZsxDczHRvQdp32" },
|
||||
{ "two", libantelope::WIF_PVT_K1, { 0x9F, 0xE3, 0xE3, 0x2B, 0x3C, 0x4B, 0x6B, 0x91, 0x6E, 0x20, 0x6C, 0xB0, 0x91, 0xDF, 0x1F, 0x5E, 0x34, 0x32, 0x88, 0x0B, 0x41, 0x33, 0x86, 0xBD, 0xF2, 0x92, 0xFF, 0x23, 0x06, 0x43, 0xF2, 0x8C}, "PVT_K1_2DRBT8jmXT8k9ywNSSbufvhk1hLFhPzWJBpsE2jo12CDoFhcc1" },
|
||||
{ "three", libantelope::WIF_PVT_K1, { 0x59, 0x3A, 0x51, 0xB5, 0x5D, 0x56, 0xAA, 0xF0, 0x5B, 0xD9, 0xD1, 0x0E, 0x6B, 0x88, 0x6D, 0xF9, 0xC4, 0x37, 0x09, 0xB2, 0x4C, 0xEC, 0xBB, 0x63, 0x68, 0x92, 0xC2, 0x94, 0x31, 0x48, 0x71, 0x8C}, "PVT_K1_gJCsP4CwMv4gTkDXiZT8QFhs3NrSB7Sv22ANGrc8Svun9uC9C" }
|
||||
};
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
CHECK( libeosio::wif_priv_encode(it->key, it->prefix) == it->expected );
|
||||
CHECK( libantelope::wif_priv_encode(it->key, it->prefix) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -8,7 +8,7 @@ TEST_CASE("WIF::wif_pub_decode [legacy]") {
|
|||
struct testcase {
|
||||
const char* name;
|
||||
std::string key;
|
||||
libeosio::ec_pubkey_t expected;
|
||||
libantelope::ec_pubkey_t expected;
|
||||
bool expectedRet;
|
||||
};
|
||||
|
||||
|
|
@ -24,9 +24,9 @@ TEST_CASE("WIF::wif_pub_decode [legacy]") {
|
|||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_pubkey_t result = { 0x0 };
|
||||
libantelope::ec_pubkey_t result = { 0x0 };
|
||||
|
||||
CHECK( libeosio::wif_pub_decode(result, it->key) == it->expectedRet );
|
||||
CHECK( libantelope::wif_pub_decode(result, it->key) == it->expectedRet );
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ TEST_CASE("WIF::wif_pub_decode [k1]") {
|
|||
struct testcase {
|
||||
const char* name;
|
||||
std::string key;
|
||||
libeosio::ec_pubkey_t expected;
|
||||
libantelope::ec_pubkey_t expected;
|
||||
bool expectedRet;
|
||||
};
|
||||
|
||||
|
|
@ -52,9 +52,9 @@ TEST_CASE("WIF::wif_pub_decode [k1]") {
|
|||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_pubkey_t result = { 0x0 };
|
||||
libantelope::ec_pubkey_t result = { 0x0 };
|
||||
|
||||
CHECK( libeosio::wif_pub_decode(result, it->key) == it->expectedRet );
|
||||
CHECK( libantelope::wif_pub_decode(result, it->key) == it->expectedRet );
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -8,20 +8,20 @@ TEST_CASE("WIF::wif_pub_encode [legacy]") {
|
|||
struct testcase {
|
||||
std::string name;
|
||||
const std::string prefix;
|
||||
libeosio::ec_pubkey_t key;
|
||||
libantelope::ec_pubkey_t key;
|
||||
std::string expected;
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests {
|
||||
{ "one", libeosio::WIF_PUB_LEG, { 0x03, 0x7a, 0x0e, 0x6b, 0xfd, 0xe4, 0xf1, 0xad, 0x36, 0x3f, 0x3a, 0xf9, 0xe0, 0x93, 0x63, 0x5a, 0xa9, 0x99, 0x21, 0x15, 0xbc, 0x23, 0x35, 0x75, 0x13, 0x69, 0x55, 0xee, 0x3f, 0xf8, 0xfd, 0x97, 0xec }, "EOS7kzJ5iFBmQWWT1LiWgAiocESD7TTNuuPCdYREUQysruq8VeFKy" },
|
||||
{ "two", libeosio::WIF_PUB_LEG, { 0x02, 0x5e, 0x94, 0xa5, 0xe7, 0x9f, 0x66, 0x37, 0x55, 0x7e, 0xc2, 0x28, 0x30, 0x40, 0x82, 0x9a, 0x38, 0x72, 0x10, 0x96, 0x6e, 0x15, 0xb7, 0xa5, 0x8a, 0x27, 0x9a, 0x71, 0x06, 0xa7, 0x64, 0x23, 0x30 }, "EOS5c9HkNCJLDebe2Wvapp8bpB38Pf1QWNpkrsFy3mshg7DZfPNeA" },
|
||||
{ "three", libeosio::WIF_PUB_LEG, { 0x03, 0xd4, 0xc6, 0x2a, 0xdc, 0x11, 0x1c, 0x65, 0x7a, 0x9f, 0x5b, 0xba, 0x96, 0x3f, 0xbb, 0x2a, 0x69, 0x2e, 0xc5, 0x4a, 0x48, 0x3b, 0xa3, 0x5f, 0x2a, 0x37, 0x6c, 0x59, 0x95, 0xb1, 0x95, 0x1c, 0xc9 }, "EOS8SwZMY8DChbbmRKS3wdHCAbv1VWgTRmQEDSaLyJk8pG4wm8BJF" }
|
||||
{ "one", libantelope::WIF_PUB_LEG, { 0x03, 0x7a, 0x0e, 0x6b, 0xfd, 0xe4, 0xf1, 0xad, 0x36, 0x3f, 0x3a, 0xf9, 0xe0, 0x93, 0x63, 0x5a, 0xa9, 0x99, 0x21, 0x15, 0xbc, 0x23, 0x35, 0x75, 0x13, 0x69, 0x55, 0xee, 0x3f, 0xf8, 0xfd, 0x97, 0xec }, "EOS7kzJ5iFBmQWWT1LiWgAiocESD7TTNuuPCdYREUQysruq8VeFKy" },
|
||||
{ "two", libantelope::WIF_PUB_LEG, { 0x02, 0x5e, 0x94, 0xa5, 0xe7, 0x9f, 0x66, 0x37, 0x55, 0x7e, 0xc2, 0x28, 0x30, 0x40, 0x82, 0x9a, 0x38, 0x72, 0x10, 0x96, 0x6e, 0x15, 0xb7, 0xa5, 0x8a, 0x27, 0x9a, 0x71, 0x06, 0xa7, 0x64, 0x23, 0x30 }, "EOS5c9HkNCJLDebe2Wvapp8bpB38Pf1QWNpkrsFy3mshg7DZfPNeA" },
|
||||
{ "three", libantelope::WIF_PUB_LEG, { 0x03, 0xd4, 0xc6, 0x2a, 0xdc, 0x11, 0x1c, 0x65, 0x7a, 0x9f, 0x5b, 0xba, 0x96, 0x3f, 0xbb, 0x2a, 0x69, 0x2e, 0xc5, 0x4a, 0x48, 0x3b, 0xa3, 0x5f, 0x2a, 0x37, 0x6c, 0x59, 0x95, 0xb1, 0x95, 0x1c, 0xc9 }, "EOS8SwZMY8DChbbmRKS3wdHCAbv1VWgTRmQEDSaLyJk8pG4wm8BJF" }
|
||||
};
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
CHECK( libeosio::wif_pub_encode(it->key, it->prefix) == it->expected );
|
||||
CHECK( libantelope::wif_pub_encode(it->key, it->prefix) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ TEST_CASE("WIF::wif_pub_encode [custom prefix]") {
|
|||
|
||||
struct testcase {
|
||||
std::string name;
|
||||
libeosio::ec_pubkey_t key;
|
||||
libantelope::ec_pubkey_t key;
|
||||
std::string expected;
|
||||
};
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ TEST_CASE("WIF::wif_pub_encode [custom prefix]") {
|
|||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
CHECK( libeosio::wif_pub_encode(it->key, "ZYX") == it->expected );
|
||||
CHECK( libantelope::wif_pub_encode(it->key, "ZYX") == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,20 +52,20 @@ TEST_CASE("WIF::wif_pub_encode [k1]") {
|
|||
struct testcase {
|
||||
std::string name;
|
||||
const std::string prefix;
|
||||
libeosio::ec_pubkey_t key;
|
||||
libantelope::ec_pubkey_t key;
|
||||
std::string expected;
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests {
|
||||
{ "one", libeosio::WIF_PUB_K1, { 0x03, 0x7a, 0x0e, 0x6b, 0xfd, 0xe4, 0xf1, 0xad, 0x36, 0x3f, 0x3a, 0xf9, 0xe0, 0x93, 0x63, 0x5a, 0xa9, 0x99, 0x21, 0x15, 0xbc, 0x23, 0x35, 0x75, 0x13, 0x69, 0x55, 0xee, 0x3f, 0xf8, 0xfd, 0x97, 0xec }, "PUB_K1_7kzJ5iFBmQWWT1LiWgAiocESD7TTNuuPCdYREUQysruq7AxzWu" },
|
||||
{ "two", libeosio::WIF_PUB_K1, { 0x02, 0x5e, 0x94, 0xa5, 0xe7, 0x9f, 0x66, 0x37, 0x55, 0x7e, 0xc2, 0x28, 0x30, 0x40, 0x82, 0x9a, 0x38, 0x72, 0x10, 0x96, 0x6e, 0x15, 0xb7, 0xa5, 0x8a, 0x27, 0x9a, 0x71, 0x06, 0xa7, 0x64, 0x23, 0x30 }, "PUB_K1_5c9HkNCJLDebe2Wvapp8bpB38Pf1QWNpkrsFy3mshg7DViSUUa" },
|
||||
{ "three", libeosio::WIF_PUB_K1, { 0x03, 0xd4, 0xc6, 0x2a, 0xdc, 0x11, 0x1c, 0x65, 0x7a, 0x9f, 0x5b, 0xba, 0x96, 0x3f, 0xbb, 0x2a, 0x69, 0x2e, 0xc5, 0x4a, 0x48, 0x3b, 0xa3, 0x5f, 0x2a, 0x37, 0x6c, 0x59, 0x95, 0xb1, 0x95, 0x1c, 0xc9 }, "PUB_K1_8SwZMY8DChbbmRKS3wdHCAbv1VWgTRmQEDSaLyJk8pG4wKBXpw" }
|
||||
{ "one", libantelope::WIF_PUB_K1, { 0x03, 0x7a, 0x0e, 0x6b, 0xfd, 0xe4, 0xf1, 0xad, 0x36, 0x3f, 0x3a, 0xf9, 0xe0, 0x93, 0x63, 0x5a, 0xa9, 0x99, 0x21, 0x15, 0xbc, 0x23, 0x35, 0x75, 0x13, 0x69, 0x55, 0xee, 0x3f, 0xf8, 0xfd, 0x97, 0xec }, "PUB_K1_7kzJ5iFBmQWWT1LiWgAiocESD7TTNuuPCdYREUQysruq7AxzWu" },
|
||||
{ "two", libantelope::WIF_PUB_K1, { 0x02, 0x5e, 0x94, 0xa5, 0xe7, 0x9f, 0x66, 0x37, 0x55, 0x7e, 0xc2, 0x28, 0x30, 0x40, 0x82, 0x9a, 0x38, 0x72, 0x10, 0x96, 0x6e, 0x15, 0xb7, 0xa5, 0x8a, 0x27, 0x9a, 0x71, 0x06, 0xa7, 0x64, 0x23, 0x30 }, "PUB_K1_5c9HkNCJLDebe2Wvapp8bpB38Pf1QWNpkrsFy3mshg7DViSUUa" },
|
||||
{ "three", libantelope::WIF_PUB_K1, { 0x03, 0xd4, 0xc6, 0x2a, 0xdc, 0x11, 0x1c, 0x65, 0x7a, 0x9f, 0x5b, 0xba, 0x96, 0x3f, 0xbb, 0x2a, 0x69, 0x2e, 0xc5, 0x4a, 0x48, 0x3b, 0xa3, 0x5f, 0x2a, 0x37, 0x6c, 0x59, 0x95, 0xb1, 0x95, 0x1c, 0xc9 }, "PUB_K1_8SwZMY8DChbbmRKS3wdHCAbv1VWgTRmQEDSaLyJk8pG4wKBXpw" }
|
||||
};
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
CHECK( libeosio::wif_pub_encode(it->key, it->prefix) == it->expected );
|
||||
CHECK( libantelope::wif_pub_encode(it->key, it->prefix) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ TEST_CASE("WIF::wif_sig_decode") {
|
|||
struct testcase {
|
||||
const char *name;
|
||||
std::string input;
|
||||
libeosio::ec_signature_t expected;
|
||||
libantelope::ec_signature_t expected;
|
||||
bool expectedRet;
|
||||
};
|
||||
|
||||
|
|
@ -87,9 +87,9 @@ TEST_CASE("WIF::wif_sig_decode") {
|
|||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_signature_t result;
|
||||
libantelope::ec_signature_t result;
|
||||
|
||||
CHECK( libeosio::wif_sig_decode(result, it->input) == it->expectedRet );
|
||||
CHECK( libantelope::wif_sig_decode(result, it->input) == it->expectedRet );
|
||||
|
||||
if (it->expectedRet == true) {
|
||||
CHECK( result == it->expected );
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ TEST_CASE("WIF::wif_sig_encode") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::ec_signature_t sig;
|
||||
libantelope::ec_signature_t sig;
|
||||
std::string expected;
|
||||
|
||||
};
|
||||
|
|
@ -47,7 +47,7 @@ TEST_CASE("WIF::wif_sig_encode") {
|
|||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
CHECK( libeosio::wif_sig_encode(it->sig) == it->expected );
|
||||
CHECK( libantelope::wif_sig_encode(it->sig) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/base58.hpp>
|
||||
#include <libantelope/base58.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -41,7 +41,7 @@ TEST_CASE("base58_decode") {
|
|||
|
||||
std::vector<unsigned char> expectedOut(it->expectedOut.begin(), it->expectedOut.end());
|
||||
|
||||
CHECK( libeosio::base58_decode(it->in, result) == it->expectedReturn );
|
||||
CHECK( libantelope::base58_decode(it->in, result) == it->expectedReturn );
|
||||
CHECK( result == expectedOut );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/base58.hpp>
|
||||
#include <libantelope/base58.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -28,7 +28,7 @@ TEST_CASE("base58::base58_encode") {
|
|||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name) {
|
||||
CHECK( libeosio::base58_encode(it->in) == it->expected );
|
||||
CHECK( libantelope::base58_encode(it->in) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/base58.hpp>
|
||||
#include <libantelope/base58.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
|
@ -23,7 +23,7 @@ TEST_CASE("base58::is_base58 [string]") {
|
|||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name) {
|
||||
CHECK(libeosio::is_base58(it->input) == it->expected);
|
||||
CHECK(libantelope::is_base58(it->input) == it->expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ TEST_CASE("base58::is_base58 [char]") {
|
|||
for(int i = 0; i < valid_alphabet.length(); i++) {
|
||||
char ch = valid_alphabet[i];
|
||||
|
||||
CHECK(libeosio::is_base58(ch));
|
||||
CHECK(libantelope::is_base58(ch));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ TEST_CASE("base58::is_base58 [char]") {
|
|||
for(int i = 0; i < invalid_alphabet.length(); i++) {
|
||||
char ch = invalid_alphabet[i];
|
||||
|
||||
CHECK_FALSE(libeosio::is_base58(ch));
|
||||
CHECK_FALSE(libantelope::is_base58(ch));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,15 +22,15 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
#include <chrono>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <libeosio/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
|
||||
|
||||
std::chrono::duration<float> _run(size_t num_keys) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
for(size_t i = 0; i < num_keys; i++) {
|
||||
struct libeosio::ec_keypair k;
|
||||
libeosio::ec_generate_key(&k);
|
||||
struct libantelope::ec_keypair k;
|
||||
libantelope::ec_generate_key(&k);
|
||||
}
|
||||
return std::chrono::steady_clock::now() - start;
|
||||
}
|
||||
|
|
@ -48,13 +48,13 @@ void test(size_t num_keys) {
|
|||
}
|
||||
|
||||
int main() {
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
test(1000);
|
||||
test(10000);
|
||||
test(100000);
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -6,9 +6,9 @@ TEST_CASE("ec::ecdsa_recover") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::sha256_t dgst;
|
||||
libeosio::ec_signature_t sig;
|
||||
libeosio::ec_pubkey_t expected;
|
||||
libantelope::sha256_t dgst;
|
||||
libantelope::ec_signature_t sig;
|
||||
libantelope::ec_pubkey_t expected;
|
||||
int expectedRet;
|
||||
};
|
||||
|
||||
|
|
@ -85,19 +85,19 @@ TEST_CASE("ec::ecdsa_recover") {
|
|||
},
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_pubkey_t result;
|
||||
libantelope::ec_pubkey_t result;
|
||||
|
||||
CHECK( libeosio::ecdsa_recover(&it->dgst, it->sig, result) == it->expectedRet );
|
||||
CHECK( libantelope::ecdsa_recover(&it->dgst, it->sig, result) == it->expectedRet );
|
||||
|
||||
if (it->expectedRet == 0) {
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -6,9 +6,9 @@ TEST_CASE("ec::ecdsa_sign") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::ec_privkey_t key;
|
||||
libeosio::ec_pubkey_t pub;
|
||||
libeosio::sha256_t dgst;
|
||||
libantelope::ec_privkey_t key;
|
||||
libantelope::ec_pubkey_t pub;
|
||||
libantelope::sha256_t dgst;
|
||||
};
|
||||
|
||||
std::vector<testcase> tests = {
|
||||
|
|
@ -92,24 +92,24 @@ TEST_CASE("ec::ecdsa_sign") {
|
|||
},
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_signature_t result;
|
||||
libantelope::ec_signature_t result;
|
||||
|
||||
CHECK( libeosio::ecdsa_sign(it->key, &it->dgst, result) == 0 );
|
||||
CHECK( libantelope::ecdsa_sign(it->key, &it->dgst, result) == 0 );
|
||||
|
||||
// Need to use verify here as different implemententations produces different signatures.
|
||||
// (i have tested eosjs, eos-go and ofc libeosio)
|
||||
// (i have tested eosjs, eos-go and ofc libantelope)
|
||||
// However, the signatures are correct and can be validated by all implementations.
|
||||
//
|
||||
// Now, how do we know that ecdsa_verify is correct?
|
||||
// well, in escdsa_verify.cpp there are tests that checks hardcoded signatures generated by different implementations and should be fine.
|
||||
|
||||
CHECK( libeosio::ecdsa_verify(&it->dgst, result, it->pub) == 0);
|
||||
CHECK( libantelope::ecdsa_verify(&it->dgst, result, it->pub) == 0);
|
||||
}
|
||||
}
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -6,9 +6,9 @@ TEST_CASE("ec::ecdsa_verify") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::sha256_t dgst;
|
||||
libeosio::ec_pubkey_t pubkey;
|
||||
libeosio::ec_signature_t sig;
|
||||
libantelope::sha256_t dgst;
|
||||
libantelope::ec_pubkey_t pubkey;
|
||||
libantelope::ec_signature_t sig;
|
||||
int expected;
|
||||
};
|
||||
|
||||
|
|
@ -176,14 +176,14 @@ TEST_CASE("ec::ecdsa_verify") {
|
|||
},
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
CHECK( libeosio::ecdsa_verify(&it->dgst, it->sig, it->pubkey) == it->expected );
|
||||
CHECK( libantelope::ecdsa_verify(&it->dgst, it->sig, it->pubkey) == it->expected );
|
||||
}
|
||||
}
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <doctest.h>
|
||||
|
||||
TEST_CASE("ec::generate") {
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
libeosio::ec_pubkey_t result;
|
||||
libeosio::ec_keypair pair;
|
||||
CHECK(libeosio::ec_generate_key(&pair) == 0);
|
||||
libantelope::ec_pubkey_t result;
|
||||
libantelope::ec_keypair pair;
|
||||
CHECK(libantelope::ec_generate_key(&pair) == 0);
|
||||
|
||||
// Can't test much because... well the private key should be random :)
|
||||
// But alteast verify that the public key belongs to the private key.
|
||||
CHECK(libeosio::ec_get_publickey(&pair.secret, &result) == 0);
|
||||
CHECK(libantelope::ec_get_publickey(&pair.secret, &result) == 0);
|
||||
CHECK( result == pair.pub );
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libeosio/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -8,8 +8,8 @@ TEST_CASE("ec::pubkey") {
|
|||
|
||||
struct testcase {
|
||||
std::string name;
|
||||
libeosio::ec_privkey_t priv;
|
||||
libeosio::ec_pubkey_t expected;
|
||||
libantelope::ec_privkey_t priv;
|
||||
libantelope::ec_pubkey_t expected;
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests {
|
||||
|
|
@ -125,16 +125,16 @@ TEST_CASE("ec::pubkey") {
|
|||
}
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
libeosio::ec_pubkey_t result;
|
||||
CHECK( libeosio::ec_get_publickey(&it->priv, &result) == 0 );
|
||||
libantelope::ec_pubkey_t result;
|
||||
CHECK( libantelope::ec_get_publickey(&it->priv, &result) == 0 );
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue