From b6d45c8704e2f0ad1c1082e78f51bb63aaf38f71 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Wed, 30 May 2007 17:30:00 +0000 Subject: - now using own MD5 algorithm --- Makefile | 6 +++--- recordings.cpp | 4 +++- tools.cpp | 11 ++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fd812e7..b5ceca2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile,v 1.37 2007/05/29 16:06:58 lordjaxom Exp $ +# $Id: Makefile,v 1.38 2007/05/30 17:30:00 winni Exp $ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -54,7 +54,7 @@ INCLUDES += -I$(VDRDIR)/include -Ihttpd DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' export DEFINES -LIBS += httpd/libhttpd.a -lssl +LIBS += httpd/libhttpd.a SUBDIRS = httpd pages css images javascript @@ -62,7 +62,7 @@ SUBDIRS = httpd pages css images javascript PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \ tools.o recordings.o tasks.o status.o epg_events.o epgsearch.o \ - grab.o + grab.o md5.o WEBLIBS = pages/libpages.a css/libcss.a images/libimages.a \ javascript/libjavascript.a diff --git a/recordings.cpp b/recordings.cpp index 6a66a77..67b3724 100644 --- a/recordings.cpp +++ b/recordings.cpp @@ -22,7 +22,8 @@ namespace vdrlive { string RecordingsManager::Md5Hash(const cRecording* recording) const { - unsigned char md5[MD5_DIGEST_LENGTH]; + return MD5Hash(recording->FileName()); +/* unsigned char md5[MD5_DIGEST_LENGTH]; const char* fileName = recording->FileName(); MD5(reinterpret_cast(fileName), strlen(fileName), md5); @@ -31,6 +32,7 @@ namespace vdrlive { for (size_t i = 0; i < MD5_DIGEST_LENGTH; i++) hashStr << (0 + md5[i]); return hashStr.str(); +*/ } const cRecording* RecordingsManager::GetByMd5Hash(const string& hash) const diff --git a/tools.cpp b/tools.cpp index 3d81f8f..38f8e98 100644 --- a/tools.cpp +++ b/tools.cpp @@ -10,6 +10,7 @@ #include "live.h" #include "setup.h" #include "tools.h" +#include "md5.h" using namespace std; @@ -134,7 +135,14 @@ string ZeroPad(int number) std::string MD5Hash(std::string const& str) { - unsigned char md5[MD5_DIGEST_LENGTH]; + char* szInput = strdup(str.c_str()); + if (!szInput) return ""; + char* szRes = MD5String(szInput); + string res = szRes; + free(szRes); + return res; + +/* unsigned char md5[MD5_DIGEST_LENGTH]; MD5(reinterpret_cast(str.c_str()), str.size(), md5); ostringstream hashStr; @@ -143,6 +151,7 @@ std::string MD5Hash(std::string const& str) hashStr << (0 + md5[i]); return hashStr.str(); +*/ } #define HOURS(x) ((x)/100) -- cgit v1.2.3