Cycles: add utility function to calculate MD5 hash of a given string

This commit is contained in:
Sergey Sharybin
2015-11-21 22:07:59 +05:00
parent 52d7bc624a
commit f8ab3fd30f
2 changed files with 9 additions and 0 deletions

View File

@@ -373,5 +373,12 @@ string MD5Hash::get_hex()
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

View File

@@ -53,6 +53,8 @@ protected:
uint8_t buf[64]; /* accumulate block */
};
string util_md5_string(const string& str);
CCL_NAMESPACE_END
#endif /* __UTIL_MD5_H__ */