Atlas - SDL_test_md5.h
Home / ext / SDL / include / SDL3 Lines: 1 | Size: 4633 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 4 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. 8 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: 12 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. 20*/ 21 22/** 23 * MD5 related functions of SDL test framework. 24 * 25 * This code is a part of the SDL test library, not the main SDL library. 26 */ 27 28/* 29 *********************************************************************** 30 ** Header file for implementation of MD5 ** 31 ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** 32 ** Created: 2/17/90 RLR ** 33 ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** 34 ** Revised (for MD5): RLR 4/27/91 ** 35 ** -- G modified to have y&~z instead of y&z ** 36 ** -- FF, GG, HH modified to add in last register done ** 37 ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** 38 ** -- distinct additive constant for each step ** 39 ** -- round 4 added, working mod 7 ** 40 *********************************************************************** 41*/ 42 43/* 44 *********************************************************************** 45 ** Message-digest routines: ** 46 ** To form the message digest for a message M ** 47 ** (1) Initialize a context buffer mdContext using MD5Init ** 48 ** (2) Call MD5Update on mdContext and M ** 49 ** (3) Call MD5Final on mdContext ** 50 ** The message digest is now in mdContext->digest[0...15] ** 51 *********************************************************************** 52*/ 53 54#ifndef SDL_test_md5_h_ 55#define SDL_test_md5_h_ 56 57#include <SDL3/SDL_stdinc.h> 58 59#include <SDL3/SDL_begin_code.h> 60/* Set up for C function definitions, even when using C++ */ 61#ifdef __cplusplus 62extern "C" { 63#endif 64 65/* ------------ Definitions --------- */ 66 67/* typedef a 32-bit type */ 68typedef Uint32 MD5UINT4; 69 70/* Data structure for MD5 (Message-Digest) computation */ 71typedef struct SDLTest_Md5Context { 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 */ 76} SDLTest_Md5Context; 77 78/* ---------- Function Prototypes ------------- */ 79 80/** 81 * initialize the context 82 * 83 * \param mdContext pointer to context variable 84 * 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. 88 */ 89void SDLCALL SDLTest_Md5Init(SDLTest_Md5Context *mdContext); 90 91/** 92 * update digest from variable length data 93 * 94 * \param mdContext pointer to context variable 95 * \param inBuf pointer to data array/string 96 * \param inLen length of data array/string 97 * 98 * Note: The function updates the message-digest context to account 99 * for the presence of each of the characters inBuf[0..inLen-1] 100 * in the message whose digest is being computed. 101 */ 102void SDLCALL SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf, 103 unsigned int inLen); 104 105/** 106 * complete digest computation 107 * 108 * \param mdContext pointer to context variable 109 * 110 * Note: The function terminates the message-digest computation and 111 * ends with the desired message digest in mdContext.digest[0..15]. 112 * Always call before using the digest[] variable. 113 */ 114void SDLCALL SDLTest_Md5Final(SDLTest_Md5Context *mdContext); 115 116/* Ends C function definitions when using C++ */ 117#ifdef __cplusplus 118} 119#endif 120#include <SDL3/SDL_close_code.h> 121 122#endif /* SDL_test_md5_h_ */ 123[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.