SDL 3.0
SDL_test_md5.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
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 * \file SDL_test_md5.h
24 *
25 * MD5 related functions of SDL test framework.
26 *
27 * This code is a part of the SDL test library, not the main SDL library.
28 */
29
30/*
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 ***********************************************************************
43*/
44
45/*
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 ***********************************************************************
54*/
55
56#ifndef SDL_test_md5_h_
57#define SDL_test_md5_h_
58
59#include <SDL3/SDL_stdinc.h>
60
61#include <SDL3/SDL_begin_code.h>
62/* Set up for C function definitions, even when using C++ */
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67/* ------------ Definitions --------- */
68
69/* typedef a 32-bit type */
71
72/* Data structure for MD5 (Message-Digest) computation */
73typedef struct SDLTest_Md5Context {
74 MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
75 MD5UINT4 buf[4]; /* scratch buffer */
76 unsigned char in[64]; /* input buffer */
77 unsigned char digest[16]; /* actual digest after Md5Final call */
79
80/* ---------- Function Prototypes ------------- */
81
82/**
83 * initialize the context
84 *
85 * \param mdContext pointer to context variable
86 *
87 * Note: The function initializes the message-digest context
88 * mdContext. Call before each new use of the context -
89 * all fields are set to zero.
90 */
91void SDLCALL SDLTest_Md5Init(SDLTest_Md5Context *mdContext);
92
93/**
94 * update digest from variable length data
95 *
96 * \param mdContext pointer to context variable
97 * \param inBuf pointer to data array/string
98 * \param inLen length of data array/string
99 *
100 * Note: The function updates the message-digest context to account
101 * for the presence of each of the characters inBuf[0..inLen-1]
102 * in the message whose digest is being computed.
103 */
104void SDLCALL SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf,
105 unsigned int inLen);
106
107/**
108 * complete digest computation
109 *
110 * \param mdContext pointer to context variable
111 *
112 * Note: The function terminates the message-digest computation and
113 * ends with the desired message digest in mdContext.digest[0..15].
114 * Always call before using the digest[] variable.
115 */
116void SDLCALL SDLTest_Md5Final(SDLTest_Md5Context *mdContext);
117
118/* Ends C function definitions when using C++ */
119#ifdef __cplusplus
120}
121#endif
122#include <SDL3/SDL_close_code.h>
123
124#endif /* SDL_test_md5_h_ */
uint32_t Uint32
Definition SDL_stdinc.h:370
Uint32 MD5UINT4
void SDLTest_Md5Final(SDLTest_Md5Context *mdContext)
void SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf, unsigned int inLen)
void SDLTest_Md5Init(SDLTest_Md5Context *mdContext)
unsigned char in[64]
unsigned char digest[16]