ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
md5.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file md5.h
1 /*
2  Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
3 
4  This software is provided 'as-is', without any express or implied
5  warranty. In no event will the authors be held liable for any damages
6  arising from the use of this software.
7 
8  Permission is granted to anyone to use this software for any purpose,
9  including commercial applications, and to alter it and redistribute it
10  freely, subject to the following restrictions:
11 
12  1. The origin of this software must not be misrepresented; you must not
13  claim that you wrote the original software. If you use this software
14  in a product, an acknowledgment in the product documentation would be
15  appreciated but is not required.
16  2. Altered source versions must be plainly marked as such, and must not be
17  misrepresented as being the original software.
18  3. This notice may not be removed or altered from any source distribution.
19 
20  L. Peter Deutsch
21  ghost@aladdin.com
22 
23  */
24 /*
25  This code implements the MD5 Algorithm defined in RFC 1321.
26  It is derived directly from the text of the RFC and not from the
27  reference implementation.
28 
29  The original and principal author of ansi2knr is L. Peter Deutsch
30  <ghost@aladdin.com>. Other authors are noted in the change history
31  that follows (in reverse chronological order):
32 
33  1999-05-03 lpd Original version.
34  */
35 /*$Id: md5.h,v 1.1.1.1 2000/07/21 01:51:14 purschke Exp $ */
36 
37 #ifndef md5_INCLUDED
38 # define md5_INCLUDED
39 
40 /*
41  * This code has some adaptations for the Ghostscript environment, but it
42  * will compile and run correctly in any environment with 8-bit chars and
43  * 32-bit ints. Specifically, it assumes that if the following are
44  * defined, they have the same meaning as in Ghostscript: P1, P2, P3,
45  * ARCH_IS_BIG_ENDIAN.
46  */
47 
48 typedef unsigned char md5_byte_t; /* 8-bit byte */
49 typedef unsigned int md5_word_t; /* 32-bit word */
50 
51 /* Define the state of the MD5 Algorithm. */
52 typedef struct md5_state_s {
53  md5_word_t count[2]; /* message length in bits, lsw first */
54  md5_word_t abcd[4]; /* digest buffer */
55  md5_byte_t buf[64]; /* accumulate block */
56 } md5_state_t;
57 
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 
64 /* Initialize the algorithm. */
65 #ifdef P1
66 void md5_init(P1(md5_state_t *pms));
67 #else
68 void md5_init(md5_state_t *pms);
69 #endif
70 
71 /* Append a string to the message. */
72 #ifdef P3
73 void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes));
74 #else
75 void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
76 #endif
77 
78 /* Finish the message and return the digest. */
79 #ifdef P2
80 void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16]));
81 #else
82 void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
83 #endif
84 
85 
86 #ifdef __cplusplus
87 } /* end extern "C" */
88 #endif
89 
90 #endif /* md5_INCLUDED */
91