diff --git a/include/libeosio/WIF.hpp b/include/libantelope/WIF.hpp similarity index 94% rename from include/libeosio/WIF.hpp rename to include/libantelope/WIF.hpp index 1b35aa8..3f055bd 100644 --- a/include/libeosio/WIF.hpp +++ b/include/libantelope/WIF.hpp @@ -21,13 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef LIBEOSIO_WIF_H -#define LIBEOSIO_WIF_H +#ifndef LIBANTELOPE_WIF_H +#define LIBANTELOPE_WIF_H #include -#include +#include -namespace libeosio { +namespace libantelope { /** * Key prefixes. (strings that is not equal to these prefixes are treated as legacy format.) @@ -94,6 +94,6 @@ std::string wif_sig_encode(const ec_signature_t& sig); */ bool wif_sig_decode(ec_signature_t& sig, const std::string& data); -} // namespace libeosio +} // namespace libantelope -#endif /* LIBEOSIO_WIF_H */ +#endif /* LIBANTELOPE_WIF_H */ diff --git a/include/libeosio/base58.hpp b/include/libantelope/base58.hpp similarity index 93% rename from include/libeosio/base58.hpp rename to include/libantelope/base58.hpp index 6975412..9d3cc58 100644 --- a/include/libeosio/base58.hpp +++ b/include/libantelope/base58.hpp @@ -21,13 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef LIBEOSIO_BASE58_H -#define LIBEOSIO_BASE58_H +#ifndef LIBANTELOPE_BASE58_H +#define LIBANTELOPE_BASE58_H #include #include -namespace libeosio { +namespace libantelope { /** * Base58 Encoding functions. @@ -61,6 +61,6 @@ size_t is_base58(const std::string& str); */ std::string& base58_strip(std::string& str); -} //namespace libeosio +} //namespace libantelope -#endif /* LIBEOSIO_BASE58_H */ +#endif /* LIBANTELOPE_BASE58_H */ diff --git a/include/libeosio/checksum.hpp b/include/libantelope/checksum.hpp similarity index 92% rename from include/libeosio/checksum.hpp rename to include/libantelope/checksum.hpp index 376ca25..9da4b8e 100644 --- a/include/libeosio/checksum.hpp +++ b/include/libantelope/checksum.hpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef LIBEOSIO_CHECKSUM_H -#define LIBEOSIO_CHECKSUM_H +#ifndef LIBANTELOPE_CHECKSUM_H +#define LIBANTELOPE_CHECKSUM_H #include #include -#include +#include -namespace libeosio { +namespace libantelope { /** * Checksum size (in bytes) @@ -68,6 +68,6 @@ inline bool checksum_validate(const unsigned char* data, std::size_t len) { #define checksum_sha256d checksum #define checksum_ripemd160 checksum -} // namespace libeosio +} // namespace libantelope -#endif /* LIBEOSIO_CHECKSUM_H */ +#endif /* LIBANTELOPE_CHECKSUM_H */ diff --git a/include/libeosio/ec.hpp b/include/libantelope/ec.hpp similarity index 91% rename from include/libeosio/ec.hpp rename to include/libantelope/ec.hpp index ff7c57b..3df6fe7 100644 --- a/include/libeosio/ec.hpp +++ b/include/libantelope/ec.hpp @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef LIBEOSIO_EC_H -#define LIBEOSIO_EC_H +#ifndef LIBANTELOPE_EC_H +#define LIBANTELOPE_EC_H -#include +#include #include #include -namespace libeosio { +namespace libantelope { /** * Elliptic curve private key size (in bytes) @@ -128,13 +128,13 @@ int ecdsa_recover(const sha256_t* digest, const ec_signature_t& sig, ec_pubkey_t */ void ec_shutdown(); -} // namespace libeosio +} // namespace libantelope // Stream operators -std::ostream& operator<<(std::ostream& os, const libeosio::ec_privkey_t& pk); +std::ostream& operator<<(std::ostream& os, const libantelope::ec_privkey_t& pk); -std::ostream& operator<<(std::ostream& os, const libeosio::ec_pubkey_t& pk); +std::ostream& operator<<(std::ostream& os, const libantelope::ec_pubkey_t& pk); -#endif /* LIBEOSIO_EC_H */ +#endif /* LIBANTELOPE_EC_H */ diff --git a/include/libeosio/hash.hpp b/include/libantelope/hash.hpp similarity index 93% rename from include/libeosio/hash.hpp rename to include/libantelope/hash.hpp index be9ac75..4ad57d7 100644 --- a/include/libeosio/hash.hpp +++ b/include/libantelope/hash.hpp @@ -21,12 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef LIBEOSIO_HASH_H -#define LIBEOSIO_HASH_H +#ifndef LIBANTELOPE_HASH_H +#define LIBANTELOPE_HASH_H #include -namespace libeosio { +namespace libantelope { /** * Hashes @@ -55,6 +55,6 @@ sha256_t* sha256d(const unsigned char *data, std::size_t len, sha256_t* out); */ ripemd160_t* ripemd160(const unsigned char *data, std::size_t len, ripemd160_t* out); -} // namespace libeosio +} // namespace libantelope -#endif /* LIBEOSIO_HASH_H */ +#endif /* LIBANTELOPE_HASH_H */ diff --git a/src/WIF.cpp b/src/WIF.cpp index cf19c16..e04f8be 100644 --- a/src/WIF.cpp +++ b/src/WIF.cpp @@ -23,12 +23,12 @@ */ #include #include -#include -#include -#include +#include +#include +#include #include "wif/codec.hpp" -namespace libeosio { +namespace libantelope { const std::string WIF_PUB_LEG = "EOS"; const std::string WIF_PUB_K1 = "PUB_K1_"; @@ -154,4 +154,4 @@ std::string wif_sig_encode(const ec_signature_t& sig) { return WIF_SIG_K1 + base58_encode(buf, buf + sizeof(buf)); } -} // namespace libeosio +} // namespace libantelope diff --git a/src/base58.cpp b/src/base58.cpp index 998c4c0..3979dc1 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -28,9 +28,9 @@ #include #include #include -#include +#include -namespace libeosio { +namespace libantelope { static const char charmap[59] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; static const int8_t table[256] = { @@ -190,4 +190,4 @@ std::string& base58_strip(std::string &str) { return str; } -} // namespace libeosio +} // namespace libantelope diff --git a/src/ec.cpp b/src/ec.cpp index 8493f02..c6ceca6 100644 --- a/src/ec.cpp +++ b/src/ec.cpp @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include +#include std::ostream& _hex(std::ostream& os, const unsigned char *b, std::size_t sz) { os << "[ " << std::hex; @@ -38,10 +38,10 @@ std::ostream& _hex(std::ostream& os, const unsigned char *b, std::size_t sz) { return os << std::oct << " ]"; } -std::ostream& operator<<(std::ostream& os, const libeosio::ec_privkey_t& k) { +std::ostream& operator<<(std::ostream& os, const libantelope::ec_privkey_t& k) { return _hex(os, k.data(), k.size()); } -std::ostream& operator<<(std::ostream& os, const libeosio::ec_pubkey_t& k) { +std::ostream& operator<<(std::ostream& os, const libantelope::ec_pubkey_t& k) { return _hex(os, k.data(), k.size()); } \ No newline at end of file diff --git a/src/libsecp256k1/ec.cpp b/src/libsecp256k1/ec.cpp index 9c6388d..190f5d6 100644 --- a/src/libsecp256k1/ec.cpp +++ b/src/libsecp256k1/ec.cpp @@ -23,10 +23,10 @@ */ #include #include -#include +#include #include "rng.h" -namespace libeosio { +namespace libantelope { secp256k1_context* ctx; @@ -90,4 +90,4 @@ int ec_generate_key(struct ec_keypair *pair) { return ec_get_publickey(&pair->secret, &pair->pub); } -} // namespace libeosio +} // namespace libantelope diff --git a/src/libsecp256k1/ecdsa.cpp b/src/libsecp256k1/ecdsa.cpp index 2a5e235..838809a 100644 --- a/src/libsecp256k1/ecdsa.cpp +++ b/src/libsecp256k1/ecdsa.cpp @@ -23,10 +23,10 @@ */ #include #include -#include +#include #include "rng.h" -namespace libeosio { +namespace libantelope { extern secp256k1_context* ctx; @@ -115,4 +115,4 @@ int ecdsa_recover(const sha256_t* digest, const ec_signature_t& sig, ec_pubkey_t return len != EC_PUBKEY_SIZE ? -1 : 0; } -} // namespace libeosio +} // namespace libantelope diff --git a/src/openssl/ec.cpp b/src/openssl/ec.cpp index c001c82..1ab7afe 100644 --- a/src/openssl/ec.cpp +++ b/src/openssl/ec.cpp @@ -24,10 +24,10 @@ #include #include #include -#include +#include #include "internal.h" -namespace libeosio { +namespace libantelope { BN_CTX *ctx = NULL; EC_KEY *k = NULL; @@ -121,4 +121,4 @@ int ec_generate_key(struct ec_keypair *pair) { return 0; } -} // namespace libeosio +} // namespace libantelope diff --git a/src/openssl/ecdsa.cpp b/src/openssl/ecdsa.cpp index cf5c2f4..9582e21 100644 --- a/src/openssl/ecdsa.cpp +++ b/src/openssl/ecdsa.cpp @@ -24,10 +24,10 @@ #include #include #include -#include +#include #include "internal.h" -namespace libeosio { +namespace libantelope { extern BN_CTX *ctx; @@ -182,4 +182,4 @@ err2: EC_KEY_free(ec_key); err1: return ret; } -} // namespace libeosio \ No newline at end of file +} // namespace libantelope \ No newline at end of file diff --git a/src/openssl/hash.cpp b/src/openssl/hash.cpp index a8dc0cd..492e23a 100644 --- a/src/openssl/hash.cpp +++ b/src/openssl/hash.cpp @@ -23,9 +23,9 @@ */ #include #include -#include +#include -namespace libeosio { +namespace libantelope { sha256_t* sha256(const unsigned char *data, std::size_t len, sha256_t* out) { return (sha256_t *) SHA256(data, len, (unsigned char*) out); @@ -40,4 +40,4 @@ ripemd160_t* ripemd160(const unsigned char *data, std::size_t len, ripemd160_t* return (ripemd160_t *) RIPEMD160(data, len, (unsigned char*) out); } -} // namespace libeosio +} // namespace libantelope diff --git a/src/openssl/internal.h b/src/openssl/internal.h index 9a5d6c1..6ceb1e5 100644 --- a/src/openssl/internal.h +++ b/src/openssl/internal.h @@ -24,8 +24,8 @@ #include #include -#ifndef LIBEOSIO_OPENSSL_INTERNAL_H -#define LIBEOSIO_OPENSSL_INTERNAL_H +#ifndef LIBANTELOPE_OPENSSL_INTERNAL_H +#define LIBANTELOPE_OPENSSL_INTERNAL_H #define EC_KEY_new_secp256k1() (EC_KEY_new_by_curve_name( NID_secp256k1 )) @@ -62,4 +62,4 @@ int ECDSA_SIG_unserialize_rs(const unsigned char *sig, BIGNUM **r, BIGNUM **s, i } #endif -#endif /* LIBEOSIO_OPENSSL_INTERNAL_H */ \ No newline at end of file +#endif /* LIBANTELOPE_OPENSSL_INTERNAL_H */ \ No newline at end of file diff --git a/src/wif/codec.hpp b/src/wif/codec.hpp index eb3e5ca..c927647 100644 --- a/src/wif/codec.hpp +++ b/src/wif/codec.hpp @@ -21,13 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef LIBEOSIO_CODEC_H -#define LIBEOSIO_CODEC_H +#ifndef LIBANTELOPE_CODEC_H +#define LIBANTELOPE_CODEC_H -#include +#include #include -namespace libeosio { namespace internal { +namespace libantelope { namespace internal { /** * Public-key encoders @@ -79,6 +79,6 @@ typedef bool (*sig_decoder_t)(const std::vector& buf, ec_signatur bool sig_decoder_k1(const std::vector& buf, ec_signature_t& sig); -}} // namespace libeosio::internal +}} // namespace libantelope::internal -#endif /* LIBEOSIO_CODEC_H */ +#endif /* LIBANTELOPE_CODEC_H */ diff --git a/src/wif/k1.cpp b/src/wif/k1.cpp index fcabac5..f7e8af2 100644 --- a/src/wif/k1.cpp +++ b/src/wif/k1.cpp @@ -22,11 +22,11 @@ * SOFTWARE. */ -#include +#include #include #include "codec.hpp" -namespace libeosio { namespace internal { +namespace libantelope { namespace internal { // Just to make it "harder" the calculated checksum for a signature (k1) and pub/priv keys in k1/r1 format. // has a suffix that is not present in the WIF encoded string. @@ -125,4 +125,4 @@ bool sig_decoder_k1(const std::vector& buf, ec_signature_t& sig) } -}} // namespace libeosio::internal \ No newline at end of file +}} // namespace libantelope::internal \ No newline at end of file diff --git a/src/wif/legacy.cpp b/src/wif/legacy.cpp index aca47a7..aa9dafb 100644 --- a/src/wif/legacy.cpp +++ b/src/wif/legacy.cpp @@ -22,10 +22,10 @@ * SOFTWARE. */ -#include +#include #include "codec.hpp" -namespace libeosio { namespace internal { +namespace libantelope { namespace internal { #define PRIV_KEY_PREFIX 0x80 /* 0x80 for "Bitcoin mainnet". Always used by EOS. */ @@ -77,4 +77,4 @@ bool priv_decoder_legacy(const std::vector& buf, ec_privkey_t& pr return true; } -}} // namespace libeosio::internal \ No newline at end of file +}} // namespace libantelope::internal \ No newline at end of file diff --git a/tests/WIF/priv_decode.cpp b/tests/WIF/priv_decode.cpp index 5105e66..b99a94e 100644 --- a/tests/WIF/priv_decode.cpp +++ b/tests/WIF/priv_decode.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -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 ); } } diff --git a/tests/WIF/priv_encode.cpp b/tests/WIF/priv_encode.cpp index bb08bd1..5030e3f 100644 --- a/tests/WIF/priv_encode.cpp +++ b/tests/WIF/priv_encode.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -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 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 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 ); } } } diff --git a/tests/WIF/pub_decode.cpp b/tests/WIF/pub_decode.cpp index 36ccad1..0754249 100644 --- a/tests/WIF/pub_decode.cpp +++ b/tests/WIF/pub_decode.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -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 ); } } diff --git a/tests/WIF/pub_encode.cpp b/tests/WIF/pub_encode.cpp index d3e548f..c88476d 100644 --- a/tests/WIF/pub_encode.cpp +++ b/tests/WIF/pub_encode.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -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 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 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 ); } } } \ No newline at end of file diff --git a/tests/WIF/sig_decode.cpp b/tests/WIF/sig_decode.cpp index e0c77e6..eb25af5 100644 --- a/tests/WIF/sig_decode.cpp +++ b/tests/WIF/sig_decode.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -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 ); diff --git a/tests/WIF/sig_encode.cpp b/tests/WIF/sig_encode.cpp index 000fd19..a7a6cbd 100644 --- a/tests/WIF/sig_encode.cpp +++ b/tests/WIF/sig_encode.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -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 ); } } } \ No newline at end of file diff --git a/tests/base58/decode.cpp b/tests/base58/decode.cpp index e482597..cd044b4 100644 --- a/tests/base58/decode.cpp +++ b/tests/base58/decode.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -41,7 +41,7 @@ TEST_CASE("base58_decode") { std::vector 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 ); } } diff --git a/tests/base58/encode.cpp b/tests/base58/encode.cpp index 6d47ed4..6ce6c2c 100644 --- a/tests/base58/encode.cpp +++ b/tests/base58/encode.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -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 ); } } } \ No newline at end of file diff --git a/tests/base58/is_base58.cpp b/tests/base58/is_base58.cpp index 5eeb56c..e210f10 100644 --- a/tests/base58/is_base58.cpp +++ b/tests/base58/is_base58.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -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)); } } } \ No newline at end of file diff --git a/tests/benchmark/ec.cpp b/tests/benchmark/ec.cpp index 79d1409..ccff750 100644 --- a/tests/benchmark/ec.cpp +++ b/tests/benchmark/ec.cpp @@ -22,15 +22,15 @@ * SOFTWARE. */ #include -#include -#include +#include +#include std::chrono::duration _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; } \ No newline at end of file diff --git a/tests/ec/ecdsa_recover.cpp b/tests/ec/ecdsa_recover.cpp index 59b7a37..40a95d8 100644 --- a/tests/ec/ecdsa_recover.cpp +++ b/tests/ec/ecdsa_recover.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -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(); } diff --git a/tests/ec/ecdsa_sign.cpp b/tests/ec/ecdsa_sign.cpp index 7c4b0e2..743a8d2 100644 --- a/tests/ec/ecdsa_sign.cpp +++ b/tests/ec/ecdsa_sign.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -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 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(); } diff --git a/tests/ec/ecdsa_verify.cpp b/tests/ec/ecdsa_verify.cpp index 7959f12..12c71d0 100644 --- a/tests/ec/ecdsa_verify.cpp +++ b/tests/ec/ecdsa_verify.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -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(); } diff --git a/tests/ec/generate.cpp b/tests/ec/generate.cpp index 4fe610d..6eb7f35 100644 --- a/tests/ec/generate.cpp +++ b/tests/ec/generate.cpp @@ -1,18 +1,18 @@ -#include +#include #include 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(); } \ No newline at end of file diff --git a/tests/ec/pubkey.cpp b/tests/ec/pubkey.cpp index 8215f25..fa2b744 100644 --- a/tests/ec/pubkey.cpp +++ b/tests/ec/pubkey.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -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 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(); } \ No newline at end of file