aboutsummaryrefslogtreecommitdiff
path: root/src/md5.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-02-19 23:44:57 +0000
committerMike Buland <eichlan@xagasoft.com>2009-02-19 23:44:57 +0000
commit4309066dff46f52690998bbd1f60ec8b1631f142 (patch)
tree07b6092622c909351f20590e7ee96d07f5b2d010 /src/md5.h
parent3f958097632256329cdbaf2219e2ba15325e9c52 (diff)
downloadlibbu++-4309066dff46f52690998bbd1f60ec8b1631f142.tar.gz
libbu++-4309066dff46f52690998bbd1f60ec8b1631f142.tar.bz2
libbu++-4309066dff46f52690998bbd1f60ec8b1631f142.tar.xz
libbu++-4309066dff46f52690998bbd1f60ec8b1631f142.zip
We have the new Bu::CryptoHash base class and Bu::Md5 is here and ready
to rock. sha1 is still only a shell, I dunno if/when I'm going to implement that one. So far Bu::Md5 is 100% compatible with md5sum in all tests performed so far, in fact the test program's output is compatible with md5sum in every way (and it's so cute and little too!) Oh, minor update for stdstream and the formatter, they can handle more handy types now.
Diffstat (limited to 'src/md5.h')
-rw-r--r--src/md5.h40
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
6namespace 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