summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-25 00:27:14 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-25 00:27:14 +0100
commit8b3f7c38278952dc97feba7d51ef39775608689b (patch)
tree22e6142387e1c06656593cd7fc88b7a193a3481d /src/lib
parent4fd257106009b2db170dafddece06ee3c190fceb (diff)
Use openssl for all MD5-ing.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util.cc23
-rw-r--r--src/lib/wscript5
2 files changed, 9 insertions, 19 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index c779268e2..935566440 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -40,7 +40,6 @@
#include <magick/MagickCore.h>
#include <magick/version.h>
#include <libdcp/version.h>
-#include <mhash.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -345,23 +344,17 @@ split_at_spaces_considering_quotes (string s)
}
string
-md5_hash (void const * data, int size)
+md5_digest (void const * data, int size)
{
- MHASH ht = mhash_init (MHASH_MD5);
- if (ht == MHASH_FAILED) {
- throw EncodeError ("could not create hash thread");
- }
-
- mhash (ht, data, size);
+ MD5_CTX md5_context;
+ MD5_Init (&md5_context);
+ MD5_Update (&md5_context, data, size);
+ unsigned char digest[MD5_DIGEST_LENGTH];
+ MD5_Final (digest, &md5_context);
- uint8_t hash[16];
- mhash_deinit (ht, hash);
-
- int const N = mhash_get_block_size (MHASH_MD5);
stringstream s;
- s << hex << setfill('0') << setw(2);
- for (int i = 0; i < N; ++i) {
- s << ((int) hash[i]);
+ for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) {
+ s << hex << setfill('0') << setw(2) << ((int) digest[i]);
}
return s.str ();
diff --git a/src/lib/wscript b/src/lib/wscript
index 26740a7e9..803ffd9ee 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -1,11 +1,8 @@
-def configure(conf):
- conf.check_cc(msg = 'Checking for library libmhash', function_name = 'mhash_init', header_name = 'mhash.h', lib = 'mhash', uselib_store = 'MHASH')
-
def build(bld):
obj = bld(features = 'cxx cxxshlib')
obj.name = 'libdvdomatic'
obj.export_includes = ['.']
- obj.uselib = 'AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE SNDFILE BOOST_FILESYSTEM BOOST_THREAD OPENJPEG POSTPROC TIFF SIGC++ MAGICK SSH DCP GLIB MHASH'
+ obj.uselib = 'AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE SNDFILE BOOST_FILESYSTEM BOOST_THREAD OPENJPEG POSTPROC TIFF SIGC++ MAGICK SSH DCP GLIB'
if bld.env.TARGET_WINDOWS:
obj.uselib += ' WINSOCK2'
obj.source = """