SDL Library

Dependents:   H261_decoder

Committer:
miruga27
Date:
Thu Sep 22 00:03:09 2016 +0000
Revision:
0:7fb6877b5d7c
SDL

Who changed what in which revision?

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