annotate src/md5.h @ 10311:b7566fc34c6c

[gaim-migrate @ 11505] Hitting the enter key when you're cursor is in the alias field of the Add Chat dialog now activates the dialogs default action. Closes bug 1075200 and patch 1078079. Thanks to Andrew Hart for taking a stab at this and wounding, but not killing. Killing is wrong! committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 03 Dec 2004 04:02:10 +0000
parents 4eb0490f5ff3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2849
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 This software is provided 'as-is', without any express or implied
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 warranty. In no event will the authors be held liable for any damages
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 arising from the use of this software.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 Permission is granted to anyone to use this software for any purpose,
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 including commercial applications, and to alter it and redistribute it
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 freely, subject to the following restrictions:
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 1. The origin of this software must not be misrepresented; you must not
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 claim that you wrote the original software. If you use this software
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 in a product, an acknowledgment in the product documentation would be
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 appreciated but is not required.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 2. Altered source versions must be plainly marked as such, and must not be
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 misrepresented as being the original software.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 3. This notice may not be removed or altered from any source distribution.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 L. Peter Deutsch
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 ghost@aladdin.com
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 /*
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 Independent implementation of MD5 (RFC 1321).
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 This code implements the MD5 Algorithm defined in RFC 1321.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 It is derived directly from the text of the RFC and not from the
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 reference implementation.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 The original and principal author of md5.h is L. Peter Deutsch
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 <ghost@aladdin.com>. Other authors are noted in the change history
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 that follows (in reverse chronological order):
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 added conditionalization for C++ compilation from Martin
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 Purschke <purschke@bnl.gov>.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 1999-05-03 lpd Original version.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 #ifndef md5_INCLUDED
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 # define md5_INCLUDED
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 /*
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 * This code has some adaptations for the Ghostscript environment, but it
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 * will compile and run correctly in any environment with 8-bit chars and
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 * 32-bit ints. Specifically, it assumes that if the following are
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 * defined, they have the same meaning as in Ghostscript: P1, P2, P3,
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 * ARCH_IS_BIG_ENDIAN.
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 typedef unsigned char md5_byte_t; /* 8-bit byte */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 typedef unsigned int md5_word_t; /* 32-bit word */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 /* Define the state of the MD5 Algorithm. */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 typedef struct md5_state_s {
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 md5_word_t count[2]; /* message length in bits, lsw first */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 md5_word_t abcd[4]; /* digest buffer */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 md5_byte_t buf[64]; /* accumulate block */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 } md5_state_t;
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 #ifdef __cplusplus
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 extern "C"
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 {
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 #endif
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 /* Initialize the algorithm. */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 #ifdef P1
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 void md5_init(P1(md5_state_t *pms));
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 #else
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 void md5_init(md5_state_t *pms);
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 #endif
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 /* Append a string to the message. */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 #ifdef P3
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes));
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 #else
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 #endif
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 /* Finish the message and return the digest. */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 #ifdef P2
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16]));
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 #else
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 #endif
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 #ifdef __cplusplus
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 } /* end extern "C" */
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 #endif
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92
4eb0490f5ff3 [gaim-migrate @ 2862]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 #endif /* md5_INCLUDED */