1 #ifndef GENESIS_UTILS_TOOLS_HASH_MD5_H_
2 #define GENESIS_UTILS_TOOLS_HASH_MD5_H_
119 MD5(
MD5 const& ) =
default;
132 static std::string
read_hex( std::shared_ptr<BaseInputSource> source );
151 void update( std::shared_ptr<BaseInputSource> source );
152 void update( std::string
const& s );
153 void update( std::istream& is );
179 static inline uint32_t F_(uint32_t x, uint32_t y, uint32_t z);
180 static inline uint32_t G_(uint32_t x, uint32_t y, uint32_t z);
181 static inline uint32_t H_(uint32_t x, uint32_t y, uint32_t z);
182 static inline uint32_t I_(uint32_t x, uint32_t y, uint32_t z);
185 static inline uint32_t rotate_left_(uint32_t x,
int n);
189 static inline void FF_(
190 uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint32_t s, uint32_t ac
192 static inline void GG_(
193 uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint32_t s, uint32_t ac
195 static inline void HH_(
196 uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint32_t s, uint32_t ac
198 static inline void II_(
199 uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint32_t s, uint32_t ac
206 static void decode_( uint32_t output[],
const uint8_t input[],
size_type len );
209 static void encode_( uint8_t output[],
const uint32_t input[],
size_type len );
250 hash1 ^= (
static_cast<result_type>( s[0] ) << 0 );
251 hash1 ^= (
static_cast<result_type>( s[1] ) << 8 );
252 hash1 ^= (
static_cast<result_type>( s[2] ) << 16 );
253 hash1 ^= (
static_cast<result_type>( s[3] ) << 24 );
254 hash1 ^= (
static_cast<result_type>( s[4] ) << 32 );
255 hash1 ^= (
static_cast<result_type>( s[5] ) << 40 );
256 hash1 ^= (
static_cast<result_type>( s[6] ) << 48 );
257 hash1 ^= (
static_cast<result_type>( s[7] ) << 56 );
258 hash2 ^= (
static_cast<result_type>( s[8] ) << 0 );
259 hash2 ^= (
static_cast<result_type>( s[9] ) << 8 );
260 hash2 ^= (
static_cast<result_type>( s[10] ) << 16 );
261 hash2 ^= (
static_cast<result_type>( s[11] ) << 24 );
262 hash2 ^= (
static_cast<result_type>( s[12] ) << 32 );
263 hash2 ^= (
static_cast<result_type>( s[13] ) << 40 );
264 hash2 ^= (
static_cast<result_type>( s[14] ) << 48 );
265 hash2 ^= (
static_cast<result_type>( s[15] ) << 56 );
266 return hash1 ^ hash2;
271 #endif // include guard