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

#include <sha224.hpp>

Classes

class  encoder
 

Public Member Functions

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

Static Public Member Functions

static sha224 hash (const char *d, uint32_t dlen)
 
static sha224 hash (const string &)
 
template<typename T >
static sha224 hash (const T &t)
 

Public Attributes

uint32_t _hash [7]
 

Friends

template<typename T >
Toperator<< (T &ds, const sha224 &ep)
 
template<typename T >
Toperator>> (T &ds, sha224 &ep)
 
sha224 operator<< (const sha224 &h1, uint32_t i)
 
bool operator== (const sha224 &h1, const sha224 &h2)
 
bool operator!= (const sha224 &h1, const sha224 &h2)
 
sha224 operator^ (const sha224 &h1, const sha224 &h2)
 
bool operator>= (const sha224 &h1, const sha224 &h2)
 
bool operator> (const sha224 &h1, const sha224 &h2)
 
bool operator< (const sha224 &h1, const sha224 &h2)
 
std::size_t hash_value (const sha224 &v)
 

Detailed Description

Definition at line 10 of file sha224.hpp.

Constructor & Destructor Documentation

◆ sha224() [1/2]

fc::sha224::sha224 ( )

Definition at line 12 of file sha224.cpp.

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

◆ sha224() [2/2]

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

Definition at line 13 of file sha224.cpp.

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

Member Function Documentation

◆ data() [1/2]

char * fc::sha224::data ( )

Definition at line 24 of file sha224.cpp.

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

◆ data() [2/2]

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

Definition at line 25 of file sha224.cpp.

25{ return (const char*)&_hash[0]; }

◆ data_size()

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

Definition at line 21 of file sha224.hpp.

21{ return 224 / 8; }

◆ hash() [1/3]

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

Definition at line 36 of file sha224.cpp.

36 {
37 encoder e;
38 e.write(d,dlen);
39 return e.result();
40 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash() [2/3]

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

Definition at line 41 of file sha224.cpp.

41 {
42 return hash( s.c_str(), s.size() );
43 }
static sha224 hash(const char *d, uint32_t dlen)
Definition sha224.cpp:36
char * s
Here is the call graph for this function:

◆ hash() [3/3]

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

Definition at line 27 of file sha224.hpp.

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

◆ operator string()

fc::sha224::operator string ( ) const

Definition at line 22 of file sha224.cpp.

22{ return str(); }
string str() const
Definition sha224.cpp:19

◆ str()

string fc::sha224::str ( ) const

Definition at line 19 of file sha224.cpp.

19 {
20 return fc::to_hex( (char*)_hash, sizeof(_hash) );
21 }
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

◆ hash_value

std::size_t hash_value ( const sha224 & v)
friend

Definition at line 69 of file sha224.hpp.

69{ return uint64_t(v._hash[1])<<32 | v._hash[2]; }
unsigned __int64 uint64_t
Definition stdint.h:136

◆ operator!=

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

Definition at line 77 of file sha224.cpp.

77 {
78 return memcmp( h1._hash, h2._hash, sizeof(sha224) ) != 0;
79 }

◆ operator<

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

Definition at line 74 of file sha224.cpp.

74 {
75 return memcmp( h1._hash, h2._hash, sizeof(sha224) ) < 0;
76 }

◆ operator<< [1/2]

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

Definition at line 57 of file sha224.cpp.

57 {
58 sha224 result;
59 fc::detail::shift_l( h1.data(), result.data(), result.data_size(), i );
60 return result;
61 }

◆ operator<< [2/2]

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

Definition at line 51 of file sha224.hpp.

51 {
52 static_assert( sizeof(ep) == (8*3+4), "sha224 size mismatch" );
53 ds.write( ep.data(), sizeof(ep) );
54 return ds;
55 }
static const Segment ds(Segment::ds)

◆ operator==

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

Definition at line 80 of file sha224.cpp.

80 {
81 return memcmp( h1._hash, h2._hash, sizeof(sha224) ) == 0;
82 }

◆ operator>

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

Definition at line 71 of file sha224.cpp.

71 {
72 return memcmp( h1._hash, h2._hash, sizeof(sha224) ) > 0;
73 }

◆ operator>=

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

Definition at line 68 of file sha224.cpp.

68 {
69 return memcmp( h1._hash, h2._hash, sizeof(sha224) ) >= 0;
70 }

◆ operator>>

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

Definition at line 58 of file sha224.hpp.

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

◆ operator^

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

Definition at line 62 of file sha224.cpp.

62 {
63 sha224 result;
64 for( uint32_t i = 0; i < 7; ++i )
65 result._hash[i] = h1._hash[i] ^ h2._hash[i];
66 return result;
67 }
unsigned int uint32_t
Definition stdint.h:126

Member Data Documentation

◆ _hash

uint32_t fc::sha224::_hash[7]

Definition at line 71 of file sha224.hpp.


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