Cycles: add utility function to calculate MD5 hash of a given string
This commit is contained in:
@@ -373,5 +373,12 @@ string MD5Hash::get_hex()
|
|||||||
return string(buf);
|
return string(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string util_md5_string(const string& str)
|
||||||
|
{
|
||||||
|
MD5Hash md5;
|
||||||
|
md5.append((uint8_t*)str.c_str(), str.size());
|
||||||
|
return md5.get_hex();
|
||||||
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
|
@@ -53,6 +53,8 @@ protected:
|
|||||||
uint8_t buf[64]; /* accumulate block */
|
uint8_t buf[64]; /* accumulate block */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
string util_md5_string(const string& str);
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* __UTIL_MD5_H__ */
|
#endif /* __UTIL_MD5_H__ */
|
||||||
|
Reference in New Issue
Block a user