mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-06-17 12:00:02 +02:00
include/libeosio/WIF.hpp: adding signature encode/decode functions.
This commit is contained in:
parent
8a6b476a8b
commit
73819444e5
5 changed files with 225 additions and 1 deletions
53
tests/WIF/sig_encode.cpp
Normal file
53
tests/WIF/sig_encode.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include <libeosio/WIF.hpp>
|
||||
#include <libeosio/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
TEST_CASE("WIF::wif_sig_encode") {
|
||||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::ec_signature_t sig;
|
||||
std::string expected;
|
||||
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests = {
|
||||
{
|
||||
"first",
|
||||
{
|
||||
0x20,0x1f,0x32,0xfb,0x5f,0x24,0xd2,0x57,
|
||||
0x5c,0xcc,0x51,0xf3,0xf1,0x60,0x47,0xf7,
|
||||
0x5c,0x5e,0x8e,0xb0,0xb1,0xc2,0x6d,0x76,
|
||||
0x07,0xc1,0x9e,0x24,0xd7,0xbb,0xc1,0x69,
|
||||
0x9a,0x04,0xba,0xa7,0x32,0xc7,0xef,0x83,
|
||||
0x1d,0xa9,0x40,0xde,0x9c,0xc8,0xf1,0xd9,
|
||||
0x7b,0xe5,0x0e,0xaf,0x90,0xdf,0xce,0x98,
|
||||
0xc5,0x34,0x55,0x04,0x9b,0x20,0x72,0x9a,
|
||||
0x96
|
||||
},
|
||||
"SIG_K1_KYq4LKCQ1Pdk38TY4FqwxiHRQd53b2kffB7G2Lt5WiV8VzZAvwCdbRVC5AjZvEkmXSEwyFkAFACHj1hYos8hB7Ass7RY2f"
|
||||
},
|
||||
{
|
||||
"second",
|
||||
{
|
||||
0x1f,0x36,0x28,0x1c,0xe3,0xda,0x53,0x40,
|
||||
0x09,0x28,0xa8,0xad,0x68,0xb3,0x3a,0xb7,
|
||||
0x90,0xf7,0x55,0xff,0x60,0xf0,0x51,0x9b,
|
||||
0xb6,0xd8,0x48,0xff,0x09,0xbb,0x5d,0x17,
|
||||
0xa2,0x1a,0xe0,0x55,0xe5,0x75,0xf4,0xb9,
|
||||
0x67,0x5a,0x42,0x2c,0xf3,0x8f,0x40,0x32,
|
||||
0x1d,0x76,0x23,0x54,0xae,0xdc,0xfb,0xb9,
|
||||
0xf3,0x16,0x88,0x3e,0x62,0xec,0x7f,0x0d,
|
||||
0x9f
|
||||
},
|
||||
"SIG_K1_K2Liiq4wXeeWfndxGM23xms5AR5oK99RvKRR9NpW9eemKWKD1FmpmnwEbpZUSBzQC77KwYptvW6cwGjWR6D3qDddH3w69J"
|
||||
},
|
||||
};
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
CHECK( libeosio::wif_sig_encode(it->sig) == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue