summaryrefslogtreecommitdiff
path: root/depends/md5/md5wrapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'depends/md5/md5wrapper.h')
-rw-r--r--depends/md5/md5wrapper.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/depends/md5/md5wrapper.h b/depends/md5/md5wrapper.h
new file mode 100644
index 00000000..1a41192a
--- /dev/null
+++ b/depends/md5/md5wrapper.h
@@ -0,0 +1,69 @@
+/*
+ * This is my wrapper-class to create
+ * a MD5 Hash from a string and a file.
+ *
+ * This code is completly free, you
+ * can copy it, modify it, or do
+ * what ever you want with it.
+ *
+ * Feb. 2005
+ * Benjamin Grüdelbach
+ */
+
+/*
+ * Changed unsigned long int types into uint32_t to make this work on 64bit systems.
+ * Sep. 5. 2009
+ * Petr Mrázek
+ */
+
+//include protection
+#ifndef MD5WRAPPER_H
+#define MD5WRAPPER_H
+
+//basic includes
+#include <string>
+#include <stdint.h>
+
+class md5wrapper
+{
+ private:
+ /*
+ * internal hash function, calling
+ * the basic methods from md5.h
+ */
+ std::string hashit(std::string text);
+
+ /*
+ * converts the numeric giets to
+ * a valid std::string
+ */
+ std::string convToString(unsigned char *bytes);
+ public:
+ //constructor
+ md5wrapper();
+
+ //destructor
+ ~md5wrapper();
+
+ /*
+ * creates a MD5 hash from
+ * "text" and returns it as
+ * string
+ */
+ std::string getHashFromString(std::string text);
+
+ /*
+ * creates a MD5 hash from
+ * a file specified in "filename" and
+ * returns it as string
+ */
+ std::string getHashFromFile(const std::string filename, uint32_t & length, char * first_kb = NULL);
+};
+
+
+//include protection
+#endif
+
+/*
+ * EOF
+ */