2 Simple DirectMedia Layer
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
23 * \file SDL_test_md5.h
25 * Include file for SDL test framework.
27 * This code is a part of the SDL2_test library, not the main SDL library.
31 ***********************************************************************
32 ** Header file for implementation of MD5 **
33 ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
34 ** Created: 2/17/90 RLR **
35 ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
36 ** Revised (for MD5): RLR 4/27/91 **
37 ** -- G modified to have y&~z instead of y&z **
38 ** -- FF, GG, HH modified to add in last register done **
39 ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
40 ** -- distinct additive constant for each step **
41 ** -- round 4 added, working mod 7 **
42 ***********************************************************************
46 ***********************************************************************
47 ** Message-digest routines: **
48 ** To form the message digest for a message M **
49 ** (1) Initialize a context buffer mdContext using MD5Init **
50 ** (2) Call MD5Update on mdContext and M **
51 ** (3) Call MD5Final on mdContext **
52 ** The message digest is now in mdContext->digest[0...15] **
53 ***********************************************************************
56 #ifndef _SDL_test_md5_h
57 #define _SDL_test_md5_h
59 #include "begin_code.h"
60 /* Set up for C function definitions, even when using C++ */
65 /* ------------ Definitions --------- */
67 /* typedef a 32-bit type */
68 typedef unsigned long int MD5UINT4;
70 /* Data structure for MD5 (Message-Digest) computation */
72 MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
73 MD5UINT4 buf[4]; /* scratch buffer */
74 unsigned char in[64]; /* input buffer */
75 unsigned char digest[16]; /* actual digest after Md5Final call */
78 /* ---------- Function Prototypes ------------- */
81 * /brief initialize the context
83 * /param mdContext pointer to context variable
85 * Note: The function initializes the message-digest context
86 * mdContext. Call before each new use of the context -
87 * all fields are set to zero.
89 void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
93 * /brief update digest from variable length data
95 * /param mdContext pointer to context variable
96 * /param inBuf pointer to data array/string
97 * /param inLen length of data array/string
99 * Note: The function updates the message-digest context to account
100 * for the presence of each of the characters inBuf[0..inLen-1]
101 * in the message whose digest is being computed.
104 void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
109 * /brief complete digest computation
111 * /param mdContext pointer to context variable
113 * Note: The function terminates the message-digest computation and
114 * ends with the desired message digest in mdContext.digest[0..15].
115 * Always call before using the digest[] variable.
118 void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
121 /* Ends C function definitions when using C++ */
125 #include "close_code.h"
127 #endif /* _SDL_test_md5_h */
129 /* vi: set ts=4 sw=4 expandtab: */