diff options
Diffstat (limited to 'src/md5.h')
-rw-r--r-- | src/md5.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/md5.h b/src/md5.h new file mode 100644 index 0000000..c548041 --- /dev/null +++ b/src/md5.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef BU_MD5_H | ||
2 | #define BU_MD5_H | ||
3 | |||
4 | #include "bu/cryptohash.h" | ||
5 | |||
6 | namespace Bu | ||
7 | { | ||
8 | /** | ||
9 | * Class for easily calculating MD5 sums of just about any data. | ||
10 | *@author Mike Buland | ||
11 | */ | ||
12 | class Md5 : public Bu::CryptoHash | ||
13 | { | ||
14 | public: | ||
15 | /** Build an MD5 sum builder. */ | ||
16 | Md5(); | ||
17 | |||
18 | /** Deconstruct */ | ||
19 | virtual ~Md5(); | ||
20 | |||
21 | virtual void reset(); | ||
22 | virtual void setSalt( const Bu::FString &sSalt ); | ||
23 | virtual void addData( const char *sData, int iSize ); | ||
24 | using Bu::CryptoHash::addData; | ||
25 | virtual FString getResult(); | ||
26 | |||
27 | private: | ||
28 | /** | ||
29 | * Compute one block of input data. | ||
30 | */ | ||
31 | void compBlock( long *x, long *lsum ); | ||
32 | |||
33 | long inbuf[16]; | ||
34 | long iFill; | ||
35 | long sum[4]; | ||
36 | uint64_t iBytes; | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | #endif | ||