adding new test code
This commit is contained in:
parent
bd66f1c5af
commit
a69abee4c4
1 changed files with 23 additions and 0 deletions
23
tests/ecc_test.cpp
Normal file
23
tests/ecc_test.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <fc/crypto/elliptic.hpp>
|
||||||
|
#include <bts/address.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main( int argc, char** argv )
|
||||||
|
{
|
||||||
|
std::string pass(argv[1]);
|
||||||
|
fc::sha256 h = fc::sha256::hash( pass.c_str(), pass.size() );
|
||||||
|
fc::ecc::private_key priv = fc::ecc::private_key::generate_from_seed(h);
|
||||||
|
fc::ecc::public_key pub = priv.get_public_key();
|
||||||
|
std::cerr<<"oroginal master pubkey1: "<<std::string(bts::address(pub))<<"\n";
|
||||||
|
|
||||||
|
pass += "1";
|
||||||
|
fc::sha256 h2 = fc::sha256::hash( pass.c_str(), pass.size() );
|
||||||
|
fc::ecc::public_key pub1 = pub.mult( h2 );
|
||||||
|
fc::ecc::private_key priv1 = fc::ecc::private_key::generate_from_seed(h, h2);
|
||||||
|
|
||||||
|
std::cerr<<"master pubkey: "<<std::string(bts::address(pub))<<"\n";
|
||||||
|
std::cerr<<"derived pubkey1: "<<std::string(bts::address(pub1))<<"\n";
|
||||||
|
std::cerr<<"actual pubkey1: "<<std::string(bts::address(priv1.get_public_key()))<<"\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue