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 | 41b28681f9a286d2ee98dab7915c0e735704286e (patch) | |
tree | 714d704883236b3ef4b7a0fed4bb10cd351bc7cb /utils | |
parent | 14d75abcb764b3185473b6868055736946822575 (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(); } |