summaryrefslogtreecommitdiff
path: root/src/lib/md5_digester.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-03 14:30:42 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-03 14:30:42 +0100
commitc5b3d91fab31fde4c21e1cc5bb5adb1d6d26fcca (patch)
treea88349c4c4e6e8304d92161529a5ca3dc5271a7b /src/lib/md5_digester.h
parentfd26b3243015824bebe8ec41c6b4a0d81748e81a (diff)
Include audio mapping in the digest used to distinguish different
audio analyses so that the analyses are re-computed when the mapping changes. Reported-by: Matthias Damm
Diffstat (limited to 'src/lib/md5_digester.h')
-rw-r--r--src/lib/md5_digester.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/md5_digester.h b/src/lib/md5_digester.h
new file mode 100644
index 000000000..d5b6a9c4c
--- /dev/null
+++ b/src/lib/md5_digester.h
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <string>
+#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+#include <openssl/md5.h>
+
+class MD5Digester : public boost::noncopyable
+{
+public:
+ MD5Digester ();
+ ~MD5Digester ();
+
+ void add (void const * data, size_t size);
+
+ template <class T>
+ void add (T data) {
+ add (&data, sizeof (T));
+ }
+
+ std::string get () const;
+
+private:
+ mutable MD5_CTX _context;
+ mutable boost::optional<std::string> _digest;
+};