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 ); }
/** * The goal of the small hash is to be secure using as few * bits as possible. * * Performs small_hash( sha512(data,len) ) */ uint160 small_hash( const char* data, size_t len ) { return small_hash( fc::sha512::hash(data,len) ); }
uint160 signed_transaction::id()const { fc::sha512::encoder enc; fc::raw::pack( enc, *this ); return small_hash( enc.result() ); }
/** * @return the digest of the block header used to evaluate the proof of work */ uint160 block_header::digest()const { fc::sha512::encoder enc; fc::raw::pack( enc, *this ); return small_hash( enc.result() ); }