20 #include "mongo/util/md5.h"
28 typedef unsigned char md5digest[16];
30 inline void md5(
const void *buf,
int nbytes, md5digest digest) {
33 md5_append(&st, (
const md5_byte_t *) buf, nbytes);
34 md5_finish(&st, digest);
37 inline void md5(
const char *str, md5digest digest) {
38 md5(str, strlen(str), digest);
41 inline std::string digestToString( md5digest digest ){
42 static const char * letters =
"0123456789abcdef";
44 for (
int i=0; i<16; i++){
45 unsigned char c = digest[i];
46 ss << letters[ ( c >> 4 ) & 0xf ] << letters[ c & 0xf ];
51 inline std::string md5simpledigest(
const void* buf,
int nbytes){
53 md5( buf, nbytes , d );
54 return digestToString( d );
57 inline std::string md5simpledigest(
const std::string& s ){
58 return md5simpledigest(s.data(), s.size());
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20