md5.h
author Darkvater
Sat, 02 Apr 2005 23:05:09 +0000
changeset 1632 10c391e108b7
parent 915 d845fe7cf6f2
child 1884 804ff5f94ed0
permissions -rw-r--r--
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
- Fix: 'L' no longer opens ingame terraform bar in scenario editor bar, but the land generator one
- Feature: [ 1095110 ] Create Lake and draggable Create Desert tools (initial implementation GoneWacko), also added sticky buttons to land generator and town generator
- CodeChange: moved around some of the draggable tools, demystifying them
- CodeChange: change CmdBuildCanal to allow for XANDY dragging not only X or Y (only scenario editor)
- CodeChange: add some more enums to sprites.
- TODO: merge most of the ingame and scenario editor land terraform code. This can only be done after OnClickButton function is changed so it also includes the backreference to the widget being clicked, postponed to after 0.4.0
602
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     1
/*
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     2
  Copyright (C) 1999, 2002 Aladdin Enterprises.  All rights reserved.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     3
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     4
  This software is provided 'as-is', without any express or implied
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     5
  warranty.  In no event will the authors be held liable for any damages
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     6
  arising from the use of this software.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     7
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     8
  Permission is granted to anyone to use this software for any purpose,
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
     9
  including commercial applications, and to alter it and redistribute it
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    10
  freely, subject to the following restrictions:
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    11
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    12
  1. The origin of this software must not be misrepresented; you must not
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    13
     claim that you wrote the original software. If you use this software
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    14
     in a product, an acknowledgment in the product documentation would be
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    15
     appreciated but is not required.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    16
  2. Altered source versions must be plainly marked as such, and must not be
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    17
     misrepresented as being the original software.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    18
  3. This notice may not be removed or altered from any source distribution.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    19
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    20
  L. Peter Deutsch
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    21
  ghost@aladdin.com
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    22
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    23
 */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    24
/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    25
/*
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    26
  Independent implementation of MD5 (RFC 1321).
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    27
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    28
  This code implements the MD5 Algorithm defined in RFC 1321, whose
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    29
  text is available at
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    30
	http://www.ietf.org/rfc/rfc1321.txt
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    31
  The code is derived from the text of the RFC, including the test suite
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    32
  (section A.5) but excluding the rest of Appendix A.  It does not include
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    33
  any code or documentation that is identified in the RFC as being
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    34
  copyrighted.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    35
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    36
  The original and principal author of md5.h is L. Peter Deutsch
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    37
  <ghost@aladdin.com>.  Other authors are noted in the change history
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    38
  that follows (in reverse chronological order):
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    39
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    40
  2002-04-13 lpd Removed support for non-ANSI compilers; removed
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    41
	references to Ghostscript; clarified derivation from RFC 1321;
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    42
	now handles byte order either statically or dynamically.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    43
  1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    44
  1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    45
	added conditionalization for C++ compilation from Martin
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    46
	Purschke <purschke@bnl.gov>.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    47
  1999-05-03 lpd Original version.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    48
 */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    49
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    50
#ifndef md5_INCLUDED
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    51
#  define md5_INCLUDED
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    52
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    53
/*
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    54
 * This package supports both compile-time and run-time determination of CPU
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    55
 * byte order.  If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    56
 * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    57
 * defined as non-zero, the code will be compiled to run only on big-endian
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    58
 * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    59
 * run on either big- or little-endian CPUs, but will run slightly less
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    60
 * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    61
 */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    62
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    63
typedef unsigned char md5_byte_t; /* 8-bit byte */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    64
typedef unsigned int md5_word_t; /* 32-bit word */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    65
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    66
/* Define the state of the MD5 Algorithm. */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    67
typedef struct md5_state_s {
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    68
    md5_word_t count[2];	/* message length in bits, lsw first */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    69
    md5_word_t abcd[4];		/* digest buffer */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    70
    md5_byte_t buf[64];		/* accumulate block */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    71
} md5_state_t;
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    72
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    73
#ifdef __cplusplus
915
d845fe7cf6f2 (svn r1402) Trim trailing whitespace
tron
parents: 602
diff changeset
    74
extern "C"
602
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    75
{
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    76
#endif
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    77
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    78
/* Initialize the algorithm. */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    79
void md5_init(md5_state_t *pms);
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    80
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    81
/* Append a string to the message. */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    82
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    83
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    84
/* Finish the message and return the digest. */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    85
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    86
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    87
#ifdef __cplusplus
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    88
}  /* end extern "C" */
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    89
#endif
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    90
f0afb4018788 (svn r1026) -Add: [Network] Added unique id, so in network, each client has an
truelight
parents:
diff changeset
    91
#endif /* md5_INCLUDED */