PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/reporting/crashsender/md5.h

http://crashrpt.googlecode.com/
C++ Header | 96 lines | 25 code | 14 blank | 57 comment | 0 complexity | 8c1982ed1047949c419e23c09e841677 MD5 | raw file
 1/************************************************************************************* 
 2This file is a part of CrashRpt library.
 3Copyright (c) 2003-2013 The CrashRpt project authors. All Rights Reserved.
 4
 5Use of this source code is governed by a BSD-style license
 6that can be found in the License.txt file in the root of the source
 7tree. All contributing project authors may
 8be found in the Authors.txt file in the root of the source tree.
 9***************************************************************************************/
10
11/*
12 *	This is the C++ implementation of the MD5 Message-Digest
13 *	Algorithm desrcipted in RFC 1321.
14 *	I translated the C code from this RFC to C++.
15 *	There is no warranty.
16 *
17 *	Feb. 12. 2005
18 *	Benjamin Grüdelbach
19 */
20
21/*
22 * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
23 * rights reserved.
24 * 
25 * License to copy and use this software is granted provided that it
26 * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
27 * Algorithm" in all material mentioning or referencing this software
28 * or this function.
29 * 
30 * License is also granted to make and use derivative works provided
31 * that such works are identified as "derived from the RSA Data
32 * Security, Inc. MD5 Message-Digest Algorithm" in all material
33 * mentioning or referencing the derived work.
34 * 
35 * RSA Data Security, Inc. makes no representations concerning either
36 * the merchantability of this software or the suitability of this
37 * software for any particular purpose. It is provided "as is"
38 * without express or implied warranty of any kind.
39 * 
40 * These notices must be retained in any copies of any part of this
41 * documentation and/or software.
42 */
43
44//---------------------------------------------------------------------- 
45//include protection
46#ifndef MD5_H
47#define MD5_H
48
49//---------------------------------------------------------------------- 
50//STL includes
51#include <string>
52
53//---------------------------------------------------------------------- 
54//typedefs
55typedef unsigned char *POINTER;
56
57/*
58 * MD5 context.
59 */
60typedef struct 
61{
62	unsigned long int state[4];   	      /* state (ABCD) */
63	unsigned long int count[2]; 	      /* number of bits, modulo 2^64 (lsb first) */
64	unsigned char buffer[64];	      /* input buffer */
65} MD5_CTX;
66
67/*
68 * MD5 class
69 */
70class MD5
71{
72
73	private:
74
75		void MD5Transform (unsigned long int state[4], unsigned char block[64]);
76		void Encode (unsigned char*, unsigned long int*, unsigned int);
77		void Decode (unsigned long int*, unsigned char*, unsigned int);
78		void MD5_memcpy (POINTER, POINTER, unsigned int);
79		void MD5_memset (POINTER, int, unsigned int);
80
81	public:
82	
83		void MD5Init (MD5_CTX*);
84		void MD5Update (MD5_CTX*, unsigned char*, unsigned int);
85		void MD5Final (unsigned char [16], MD5_CTX*);
86
87	MD5(){};
88};
89
90//---------------------------------------------------------------------- 
91//End of include protection
92#endif
93
94/*
95 * EOF
96 */