Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
129 lines (106 loc) · 4.52 KB

SDL_test_md5.h

File metadata and controls

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