summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2007-05-06 11:07:38 +0000
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2007-05-06 11:07:38 +0000
commit85565b4b3235b9afa009ac1c52e034fc4c006582 (patch)
tree9a0dca573a89bd2f68dd13eea5ae727387b4f262 /tools.cpp
parent2a71cc466e8d0e2ced62549ded8d6e321b0ab5f9 (diff)
downloadvdr-plugin-live-85565b4b3235b9afa009ac1c52e034fc4c006582.tar.gz
vdr-plugin-live-85565b4b3235b9afa009ac1c52e034fc4c006582.tar.bz2
- admin password is now stored as <length>:<md5 hash of password> in live.AdminPasswordMD5
(default password keeps 'live', so please re-edit your password via OSD) - new function MD5Hash in tools - changed epgsearch to use MD5Hash of tools
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools.cpp b/tools.cpp
index 8959317..da3956f 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -4,6 +4,7 @@
#include <tnt/htmlescostream.h>
#include <tnt/httprequest.h>
#include <tnt/httpreply.h>
+#include <openssl/md5.h>
#include "exception.h"
#include "live.h"
#include "setup.h"
@@ -130,5 +131,17 @@ string ZeroPad(int number)
return os.str();
}
+std::string MD5Hash(std::string const& str)
+{
+ unsigned char md5[MD5_DIGEST_LENGTH];
+ MD5(reinterpret_cast<const unsigned char*>(str.c_str()), str.size(), md5);
+
+ ostringstream hashStr;
+ hashStr << hex;
+ for (size_t i = 0; i < MD5_DIGEST_LENGTH; i++)
+ hashStr << (0 + md5[i]);
+
+ return hashStr.str();
+}
} // namespace vdrlive