Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::ripemd160 Class Reference

#include <ripemd160.hpp>

Classes

class  encoder
 

Public Member Functions

 ripemd160 ()
 
 ripemd160 (const string &hex_str)
 
string str () const
 
 operator string () const
 
char * data () const
 
size_t data_size () const
 

Static Public Member Functions

static ripemd160 hash (const fc::sha512 &h)
 
static ripemd160 hash (const fc::sha256 &h)
 
static ripemd160 hash (const char *d, uint32_t dlen)
 
static ripemd160 hash (const string &)
 
template<typename T >
static ripemd160 hash (const T &t)
 

Public Attributes

uint32_t _hash [5]
 

Friends

template<typename T >
Toperator<< (T &ds, const ripemd160 &ep)
 
template<typename T >
Toperator>> (T &ds, ripemd160 &ep)
 
ripemd160 operator<< (const ripemd160 &h1, uint32_t i)
 
bool operator== (const ripemd160 &h1, const ripemd160 &h2)
 
bool operator!= (const ripemd160 &h1, const ripemd160 &h2)
 
ripemd160 operator^ (const ripemd160 &h1, const ripemd160 &h2)
 
bool operator>= (const ripemd160 &h1, const ripemd160 &h2)
 
bool operator> (const ripemd160 &h1, const ripemd160 &h2)
 
bool operator< (const ripemd160 &h1, const ripemd160 &h2)
 

Detailed Description

Definition at line 11 of file ripemd160.hpp.

Constructor & Destructor Documentation

◆ ripemd160() [1/2]

fc::ripemd160::ripemd160 ( )

Definition at line 16 of file ripemd160.cpp.

16{ memset( _hash, 0, sizeof(_hash) ); }
uint32_t _hash[5]
Definition ripemd160.hpp:71
memset(pInfo->slotDescription, ' ', 64)
Here is the call graph for this function:

◆ ripemd160() [2/2]

fc::ripemd160::ripemd160 ( const string & hex_str)
explicit

Definition at line 17 of file ripemd160.cpp.

17 {
18 auto bytes_written = fc::from_hex( hex_str, (char*)_hash, sizeof(_hash) );
19 if( bytes_written < sizeof(_hash) )
20 memset( (char*)_hash + bytes_written, 0, (sizeof(_hash) - bytes_written) );
21}
uint8_t from_hex(char c)
Definition hex.cpp:6
Here is the call graph for this function:

Member Function Documentation

◆ data()

char * fc::ripemd160::data ( ) const

Definition at line 28 of file ripemd160.cpp.

28{ return (char*)&_hash[0]; }
Here is the caller graph for this function:

◆ data_size()

size_t fc::ripemd160::data_size ( ) const
inline

Definition at line 21 of file ripemd160.hpp.

21{ return 160/8; }

◆ hash() [1/5]

ripemd160 fc::ripemd160::hash ( const char * d,
uint32_t dlen )
static

Definition at line 52 of file ripemd160.cpp.

52 {
53 encoder e;
54 e.write(d,dlen);
55 return e.result();
56}
Here is the call graph for this function:

◆ hash() [2/5]

ripemd160 fc::ripemd160::hash ( const fc::sha256 & h)
static

Definition at line 48 of file ripemd160.cpp.

49{
50 return hash( (const char*)&h, sizeof(h) );
51}
static ripemd160 hash(const fc::sha512 &h)
Definition ripemd160.cpp:44
Here is the call graph for this function:

◆ hash() [3/5]

ripemd160 fc::ripemd160::hash ( const fc::sha512 & h)
static

Definition at line 44 of file ripemd160.cpp.

45{
46 return hash( (const char*)&h, sizeof(h) );
47}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash() [4/5]

ripemd160 fc::ripemd160::hash ( const string & s)
static

Definition at line 57 of file ripemd160.cpp.

57 {
58 return hash( s.c_str(), s.size() );
59}
char * s
Here is the call graph for this function:

◆ hash() [5/5]

template<typename T >
static ripemd160 fc::ripemd160::hash ( const T & t)
inlinestatic

Definition at line 29 of file ripemd160.hpp.

30 {
31 ripemd160::encoder e;
32 fc::raw::pack(e,t);
33 return e.result();
34 }
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
Here is the call graph for this function:

◆ operator string()

fc::ripemd160::operator string ( ) const
explicit

Definition at line 26 of file ripemd160.cpp.

26{ return str(); }
string str() const
Definition ripemd160.cpp:23

◆ str()

string fc::ripemd160::str ( ) const

Definition at line 23 of file ripemd160.cpp.

23 {
24 return fc::to_hex( (char*)_hash, sizeof(_hash) );
25}
fc::string to_hex(const char *d, uint32_t s)
Definition hex.cpp:17
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const ripemd160 & h1,
const ripemd160 & h2 )
friend

Definition at line 96 of file ripemd160.cpp.

96 {
97 return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) != 0;
98}

◆ operator<

bool operator< ( const ripemd160 & h1,
const ripemd160 & h2 )
friend

Definition at line 93 of file ripemd160.cpp.

93 {
94 return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) < 0;
95}

◆ operator<< [1/2]

ripemd160 operator<< ( const ripemd160 & h1,
uint32_t i )
friend

Definition at line 73 of file ripemd160.cpp.

73 {
74 ripemd160 result;
75 fc::detail::shift_l( h1.data(), result.data(), result.data_size(), i );
76 return result;
77}

◆ operator<< [2/2]

template<typename T >
T & operator<< ( T & ds,
const ripemd160 & ep )
friend

Definition at line 53 of file ripemd160.hpp.

53 {
54 ds.write( ep.data(), sizeof(ep) );
55 return ds;
56 }
static const Segment ds(Segment::ds)

◆ operator==

bool operator== ( const ripemd160 & h1,
const ripemd160 & h2 )
friend

Definition at line 99 of file ripemd160.cpp.

99 {
100 return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) == 0;
101}

◆ operator>

bool operator> ( const ripemd160 & h1,
const ripemd160 & h2 )
friend

Definition at line 90 of file ripemd160.cpp.

90 {
91 return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) > 0;
92}

◆ operator>=

bool operator>= ( const ripemd160 & h1,
const ripemd160 & h2 )
friend

Definition at line 87 of file ripemd160.cpp.

87 {
88 return memcmp( h1._hash, h2._hash, sizeof(h1._hash) ) >= 0;
89}

◆ operator>>

template<typename T >
T & operator>> ( T & ds,
ripemd160 & ep )
friend

Definition at line 59 of file ripemd160.hpp.

59 {
60 ds.read( ep.data(), sizeof(ep) );
61 return ds;
62 }

◆ operator^

ripemd160 operator^ ( const ripemd160 & h1,
const ripemd160 & h2 )
friend

Definition at line 78 of file ripemd160.cpp.

78 {
79 ripemd160 result;
80 result._hash[0] = h1._hash[0] ^ h2._hash[0];
81 result._hash[1] = h1._hash[1] ^ h2._hash[1];
82 result._hash[2] = h1._hash[2] ^ h2._hash[2];
83 result._hash[3] = h1._hash[3] ^ h2._hash[3];
84 result._hash[4] = h1._hash[4] ^ h2._hash[4];
85 return result;
86}

Member Data Documentation

◆ _hash

uint32_t fc::ripemd160::_hash[5]

Definition at line 71 of file ripemd160.hpp.


The documentation for this class was generated from the following files: