diff options
author | Guest_account Guest_account prguest11 <prguest11@taipan.cs> | 2011-09-17 01:39:07 +0100 |
---|---|---|
committer | Guest_account Guest_account prguest11 <prguest11@taipan.cs> | 2011-09-17 01:39:07 +0100 |
commit | 1afbff874473c79619ce74cdf90f3c312185e4e1 (patch) | |
tree | 997d2cc819e07c83c545bc0d17a3d3ffeacee47a /utils | |
parent | b01f2499efa155a227f13e34f1aed9f54c39ab91 (diff) |
add dep
Diffstat (limited to 'utils')
-rw-r--r-- | utils/stringlib.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/stringlib.cc b/utils/stringlib.cc index 3a56965c..1a152985 100644 --- a/utils/stringlib.cc +++ b/utils/stringlib.cc @@ -2,6 +2,7 @@ #include <cstring> #include <cstdlib> +#include <cstdio> #include <cassert> #include <iostream> #include <map> @@ -104,11 +105,11 @@ public: typedef unsigned int size_type; // must be 32bit MD5(); - MD5(const std::string& text); + MD5(const string& text); void update(const unsigned char *buf, size_type length); void update(const char *buf, size_type length); MD5& finalize(); - std::string hexdigest() const; + string hexdigest() const; private: void init(); @@ -209,7 +210,7 @@ MD5::MD5() ////////////////////////////////////////////// // nifty shortcut ctor, compute MD5 for string and finalize it right away -MD5::MD5(const std::string &text) +MD5::MD5(const string &text) { init(); update(text.c_str(), text.length()); @@ -433,8 +434,7 @@ MD5& MD5::finalize() ////////////////////////////// // return hex representation of digest as string -std::string MD5::hexdigest() const -{ +string MD5::hexdigest() const { if (!finalized) return ""; @@ -443,12 +443,12 @@ std::string MD5::hexdigest() const sprintf(buf+i*2, "%02x", digest[i]); buf[32]=0; - return std::string(buf); + return string(buf); } ////////////////////////////// -std::string md5(const std::string& str) { +string md5(const string& str) { MD5 md5 = MD5(str); return md5.hexdigest(); } |