SDL Library
Embed:
(wiki syntax)
Show/hide line numbers
SDL_test_md5.h
Go to the documentation of this file.
00001 /* 00002 Simple DirectMedia Layer 00003 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any damages 00007 arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, 00010 including commercial applications, and to alter it and redistribute it 00011 freely, subject to the following restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not 00014 claim that you wrote the original software. If you use this software 00015 in a product, an acknowledgment in the product documentation would be 00016 appreciated but is not required. 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 3. This notice may not be removed or altered from any source distribution. 00020 */ 00021 00022 /** 00023 * \file SDL_test_md5.h 00024 * 00025 * Include file for SDL test framework. 00026 * 00027 * This code is a part of the SDL2_test library, not the main SDL library. 00028 */ 00029 00030 /* 00031 *********************************************************************** 00032 ** Header file for implementation of MD5 ** 00033 ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** 00034 ** Created: 2/17/90 RLR ** 00035 ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 00036 ** Revised (for MD5): RLR 4/27/91 ** 00037 ** -- G modified to have y&~z instead of y&z ** 00038 ** -- FF, GG, HH modified to add in last register done ** 00039 ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 00040 ** -- distinct additive constant for each step ** 00041 ** -- round 4 added, working mod 7 ** 00042 *********************************************************************** 00043 */ 00044 00045 /* 00046 *********************************************************************** 00047 ** Message-digest routines: ** 00048 ** To form the message digest for a message M ** 00049 ** (1) Initialize a context buffer mdContext using MD5Init ** 00050 ** (2) Call MD5Update on mdContext and M ** 00051 ** (3) Call MD5Final on mdContext ** 00052 ** The message digest is now in mdContext->digest[0...15] ** 00053 *********************************************************************** 00054 */ 00055 00056 #ifndef _SDL_test_md5_h 00057 #define _SDL_test_md5_h 00058 00059 #include "begin_code.h" 00060 /* Set up for C function definitions, even when using C++ */ 00061 #ifdef __cplusplus 00062 extern "C" { 00063 #endif 00064 00065 /* ------------ Definitions --------- */ 00066 00067 /* typedef a 32-bit type */ 00068 typedef unsigned long int MD5UINT4; 00069 00070 /* Data structure for MD5 (Message-Digest) computation */ 00071 typedef struct { 00072 MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ 00073 MD5UINT4 buf[4]; /* scratch buffer */ 00074 unsigned char in[64]; /* input buffer */ 00075 unsigned char digest[16]; /* actual digest after Md5Final call */ 00076 } SDLTest_Md5Context; 00077 00078 /* ---------- Function Prototypes ------------- */ 00079 00080 /** 00081 * /brief initialize the context 00082 * 00083 * /param mdContext pointer to context variable 00084 * 00085 * Note: The function initializes the message-digest context 00086 * mdContext. Call before each new use of the context - 00087 * all fields are set to zero. 00088 */ 00089 void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); 00090 00091 00092 /** 00093 * /brief update digest from variable length data 00094 * 00095 * /param mdContext pointer to context variable 00096 * /param inBuf pointer to data array/string 00097 * /param inLen length of data array/string 00098 * 00099 * Note: The function updates the message-digest context to account 00100 * for the presence of each of the characters inBuf[0..inLen-1] 00101 * in the message whose digest is being computed. 00102 */ 00103 00104 void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, 00105 unsigned int inLen); 00106 00107 00108 /* 00109 * /brief complete digest computation 00110 * 00111 * /param mdContext pointer to context variable 00112 * 00113 * Note: The function terminates the message-digest computation and 00114 * ends with the desired message digest in mdContext.digest[0..15]. 00115 * Always call before using the digest[] variable. 00116 */ 00117 00118 void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); 00119 00120 00121 /* Ends C function definitions when using C++ */ 00122 #ifdef __cplusplus 00123 } 00124 #endif 00125 #include "close_code.h" 00126 00127 #endif /* _SDL_test_md5_h */ 00128 00129 /* vi: set ts=4 sw=4 expandtab: */
Generated on Tue Jul 12 2022 15:10:20 by 1.7.2