示例#1
0
 address::address( const fc::ecc::public_key& pub )
 {
     auto dat      = pub.serialize();
     auto dat_hash = small_hash(dat.data, sizeof(dat) );
     auto check = fc::ripemd160::hash( (char*)&dat_hash, 16 );
     memcpy( addr.data, (char*)&dat_hash, sizeof(addr) );
     memcpy( &addr.data[16], (char*)&check, 4 );
 }
示例#2
0
 pts_address::pts_address( const fc::ecc::public_key& pub, bool compressed, uint8_t version )
 {
     fc::sha256 sha2;
     if( compressed )
     {
         auto dat = pub.serialize();
         sha2     = fc::sha256::hash(dat.data, sizeof(dat) );
     }
     else
     {
         auto dat = pub.serialize_ecc_point();
         sha2     = fc::sha256::hash(dat.data, sizeof(dat) );
     }
     auto rep      = fc::ripemd160::hash((char*)&sha2,sizeof(sha2));
     addr.data[0]  = version;
     memcpy( addr.data+1, (char*)&rep, sizeof(rep) );
     auto check    = fc::sha256::hash( addr.data, sizeof(rep)+1 );
     check = fc::sha256::hash(check); // double
     memcpy( addr.data+1+sizeof(rep), (char*)&check, 4 );
 }
示例#3
0
 bool operator == ( const public_key_type& p1, const fc::ecc::public_key& p2)
 {
    return p1.key_data == p2.serialize();
 }
示例#4
0
 address::address( const fc::ecc::public_key& pub )
 {
     auto dat = pub.serialize();
     addr = fc::ripemd160::hash( fc::sha512::hash( dat.data, sizeof( dat ) ) );
 }
示例#5
0
 void pack( Stream& s, const fc::ecc::public_key& pk)
 {
     fc::raw::pack( s, pk.serialize() );
 }
示例#6
0
文件: elliptic.hpp 项目: bitshares/fc
 void pack( Stream& s, const fc::ecc::public_key& pk, uint32_t _max_depth )
 {
     FC_ASSERT( _max_depth > 0 );
     fc::raw::pack( s, pk.serialize(), _max_depth - 1 );
 }