1 : #include <string>
2 :
3 : extern "C" {
4 : #include <string.h>
5 : #include <mdfour.h>
6 : }
7 :
8 : // Grabbed from linux/module.h kernel include.
9 : #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
10 :
11 : class hash
12 : {
13 : private:
14 : struct mdfour md4;
15 :
16 : public:
17 347 : hash() { start(); }
18 :
19 : void start();
20 :
21 : void add(const unsigned char *buffer, size_t size);
22 1388 : void add(const int x) { add((const unsigned char *)&x, sizeof(x)); }
23 1388 : void add(const long x) { add((const unsigned char *)&x, sizeof(x)); }
24 : void add(const long long x) { add((const unsigned char *)&x, sizeof(x)); }
25 347 : void add(const unsigned int x) { add((const unsigned char *)&x, sizeof(x)); }
26 : void add(const unsigned long x) { add((const unsigned char *)&x,
27 : sizeof(x)); }
28 : void add(const unsigned long long x) { add((const unsigned char *)&x,
29 : sizeof(x)); }
30 : void add(const char *s) { add((const unsigned char *)s, strlen(s)); }
31 1777 : void add(const std::string& s) { add((const unsigned char *)s.c_str(),
32 1777 : s.length()); }
33 :
34 : void result(std::string& r);
35 : };
36 :
37 : void find_hash (systemtap_session& s, const std::string& script);
|