aboutsummaryrefslogtreecommitdiff
path: root/src/old/md5.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/old/md5.h81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/old/md5.h b/src/old/md5.h
deleted file mode 100644
index 7f77d83..0000000
--- a/src/old/md5.h
+++ /dev/null
@@ -1,81 +0,0 @@
1#ifndef MD5_H
2#define MD5_H
3
4/**
5 * Used to store an MD5 sum in a handy container.
6 */
7typedef struct
8{
9 /** The actual data-storage for an MD5 sum. */
10 long data[4];
11} md5sum;
12
13/**
14 * Class for easily calculating MD5 sums of just about any data.
15 *@author Mike Buland
16 */
17class md5
18{
19public:
20 /** Build an MD5 sum builder. */
21 md5();
22
23 /** Deconstruct */
24 virtual ~md5();
25
26 /**
27 * Create a sum of a standard c string, null terminated. This is probably
28 * the easiest function to use.
29 *@param pSum The MD5 sum structure to fill up.
30 *@param sStr The null-terminated string to turn into an MD5 sum.
31 */
32 void sumString( md5sum *pSum, const char *sStr );
33
34 /**
35 * Create a sum of an array of arbitrary data. This is the most handy for
36 * dealing with files and so on.
37 *@param pSum The MD5 sum structure to fill up.
38 *@param aData A pointer to the base of the data to sum.
39 *@param nLen The number of bytes to use in the sum.
40 */
41 void sumData( md5sum *pSum, const char *aData, long nLen );
42
43 /**
44 * Convert an md5sum to standard hex representation. Make sure that sHex
45 * contains at least 17 characters of space.
46 *@param pSum The sum structure to convert to hex.
47 *@param sHex The string to store the hex value in.
48 */
49 void sumToHex( md5sum *pSum, char *sHex );
50
51private:
52 /**
53 * Do the bulk of the work of the md5 algorithm.
54 *@param x I'm not sure. I'll need to look it up.
55 *@param len The length of the data.
56 *@param output The sum structure to put the output in.
57 */
58 void core_md5( long *x, long len, md5sum *output );
59
60 /**
61 * Convert an array of charaters to an array of longs in a very crafty way.
62 * This also applies standard MD5 obfuscation to the resulting array, and
63 * makes it fit within MD5 size constraints.
64 *@param str The data to convert.
65 *@param len The length of the data.
66 *@param nNewLen A pointer to a variable that will hold the new length of
67 * the resulting array of longs.
68 *@returns The newly obfuscated and resized long array.
69 */
70 long *c2l( const char *str, long len, long *nNewLen );
71
72 /**
73 * Backend helper to convert an array of longs into a hex string.
74 *@param binarray The binary data to convert.
75 *@param str The string to store the hex string in.
76 */
77 void l2hexstr( long *binarray, char *str );
78
79};
80
81#endif