summaryrefslogtreecommitdiffstats
path: root/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/hash.h b/hash.h
new file mode 100644
index 00000000..e923fee4
--- /dev/null
+++ b/hash.h
@@ -0,0 +1,34 @@
+#include <string>
+
+extern "C" {
+#include <string.h>
+#include <mdfour.h>
+}
+
+class hash
+{
+private:
+ struct mdfour md4;
+
+public:
+ hash() { start(); }
+
+ void start();
+
+ void add(const unsigned char *buffer, size_t size);
+ void add(const int x) { add((const unsigned char *)&x, sizeof(x)); }
+ void add(const long x) { add((const unsigned char *)&x, sizeof(x)); }
+ void add(const long long x) { add((const unsigned char *)&x, sizeof(x)); }
+ void add(const unsigned int x) { add((const unsigned char *)&x, sizeof(x)); }
+ void add(const unsigned long x) { add((const unsigned char *)&x,
+ sizeof(x)); }
+ void add(const unsigned long long x) { add((const unsigned char *)&x,
+ sizeof(x)); }
+ void add(const char *s) { add((const unsigned char *)s, strlen(s)); }
+ void add(const std::string& s) { add((const unsigned char *)s.c_str(),
+ s.length()); }
+
+ void result(std::string& r);
+};
+
+void find_hash (systemtap_session& s, const std::string& script);