51 G_EXCEPTION( Error ,
"internal md5 error" ) ;
52 G_EXCEPTION_CLASS( InvalidState ,
"invalid md5 hash state" ) ;
53 using big_t = std::size_t ;
54 using small_t = std::size_t ;
56 { big_t a ; big_t b ; big_t c ; big_t d ; } ;
59 static_assert(
sizeof(big_t) >= 4 ,
"" ) ;
60 static_assert(
sizeof(small_t) >=
sizeof(std::size_t) &&
sizeof(small_t) <=
sizeof(big_t) ,
"" ) ;
65 explicit Md5(
const std::string &
state ) ;
69 std::string
state()
const ;
77 void add(
const std::string & data ) ;
95 static std::string
digest(
const std::string & input ) ;
99 static std::string
digest(
const std::string & input_1 ,
const std::string & input_2 ) ;
103 static std::string
digest2(
const std::string & input_1 ,
const std::string & input_2 ) ;
107 static std::string
predigest(
const std::string & padded_key ) ;
113 static std::string
postdigest(
const std::string & state_pair ,
const std::string & message ) ;
125 Md5(
const Md5 & ) = delete ;
127 void operator=(
const Md5 & ) = delete ;
128 void operator=(
Md5 && ) = delete ;
131 std::size_t m_n{0U} ;
MD5 message digest class.
static std::string postdigest(const std::string &state_pair, const std::string &message)
A convenience function that returns the value() from an outer digest that is initialised with the sec...
static std::size_t blocksize()
Returns the block size in bytes (64).
static std::string predigest(const std::string &padded_key)
A convenience function that add()s the given string of length blocksize() (typically a padded key) an...
static std::string digest2(const std::string &input_1, const std::string &input_2)
A non-overloaded name for the digest() overload taking two parameters.
static std::string digest(const std::string &input)
A convenience function that returns a digest from one input.
void add(const std::string &data)
Adds more data.
std::string value()
Returns the hash value as a 16-character string.
static std::size_t statesize()
Returns the size of the state() string (20).
static std::size_t valuesize()
Returns the value() size in bytes (16).
Md5()
Default constructor.
std::string state() const
Returns the current intermediate state as a 20 character string, although this requires the size of t...
Holds the four parts of the md5 state.
Holds the md5 state plus unprocessed residual data.