Isis 3 Programmer Reference
md5.h
1 /*
2  * This is the C++ implementation of the MD5 Message-Digest
3  * Algorithm desrcipted in RFC 1321.
4  * I translated the C code from this RFC to C++.
5  * There is no warranty.
6  *
7  * Feb. 12. 2005
8  * Benjamin Gr�delbach
9  */
10 
11 /*
12  * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
13  * rights reserved.
14  *
15  * License to copy and use this software is granted provided that it
16  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
17  * Algorithm" in all material mentioning or referencing this software
18  * or this function.
19  *
20  * License is also granted to make and use derivative works provided
21  * that such works are identified as "derived from the RSA Data
22  * Security, Inc. MD5 Message-Digest Algorithm" in all material
23  * mentioning or referencing the derived work.
24  *
25  * RSA Data Security, Inc. makes no representations concerning either
26  * the merchantability of this software or the suitability of this
27  * software for any particular purpose. It is provided "as is"
28  * without express or implied warranty of any kind.
29  *
30  * These notices must be retained in any copies of any part of this
31  * documentation and/or software.
32  */
33 
34 //----------------------------------------------------------------------
35 //include protection
36 #ifndef MD5_H
37 #define MD5_H
38 
39 //----------------------------------------------------------------------
40 //STL includes
41 #include "stdint.h"
42 #include <string>
43 
44 //----------------------------------------------------------------------
45 //typedefs
46 typedef uint8_t *POINTER;
47 
48 /*
49  * MD5 context.
50  */
51 typedef struct {
52  uint32_t state[4]; /* state (ABCD) */
53  uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
54  uint8_t buffer[64]; /* input buffer */
55 } MD5_CTX;
56 
57 /*
58  * MD5 class
59  */
60 class MD5 {
61 
62  private:
63 
64  void MD5Transform(uint32_t state[4], uint8_t block[64]);
65  void Encode(uint8_t *, uint32_t *, uint32_t);
66  void Decode(uint32_t *, uint8_t *, uint32_t);
67  void MD5_memcpy(POINTER, POINTER, uint32_t);
68  void MD5_memset(POINTER, int32_t, uint32_t);
69 
70  public:
71 
72  void MD5Init(MD5_CTX *);
73  void MD5Update(MD5_CTX *, uint8_t *, uint32_t);
74  void MD5Final(uint8_t [16], MD5_CTX *);
75 
76  MD5() {};
77 };
78 
79 //----------------------------------------------------------------------
80 //End of include protection
81 #endif
82 
83 /*
84  * EOF
85  */
Definition: md5.h:60
Definition: md5.h:51