include/SDL_test_md5.h
changeset 7191 75360622e65f
parent 6885 700f1b25f77f
child 8149 681eb46b8ac4
equal deleted inserted replaced
7190:11612d544fcd 7191:75360622e65f
    19   3. This notice may not be removed or altered from any source distribution.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    20 */
    21 
    21 
    22 /**
    22 /**
    23  *  \file SDL_test_md5.h
    23  *  \file SDL_test_md5.h
    24  *  
    24  *
    25  *  Include file for SDL test framework.
    25  *  Include file for SDL test framework.
    26  *
    26  *
    27  *  This code is a part of the SDL2_test library, not the main SDL library.
    27  *  This code is a part of the SDL2_test library, not the main SDL library.
    28  */
    28  */
    29 
    29 
    57 #define _SDL_test_md5_h
    57 #define _SDL_test_md5_h
    58 
    58 
    59 #include "begin_code.h"
    59 #include "begin_code.h"
    60 /* Set up for C function definitions, even when using C++ */
    60 /* Set up for C function definitions, even when using C++ */
    61 #ifdef __cplusplus
    61 #ifdef __cplusplus
    62 /* *INDENT-OFF* */
       
    63 extern "C" {
    62 extern "C" {
    64 /* *INDENT-ON* */
       
    65 #endif
    63 #endif
    66 
    64 
    67 /* ------------ Definitions --------- */
    65 /* ------------ Definitions --------- */
    68 
    66 
    69 /* typedef a 32-bit type */
    67 /* typedef a 32-bit type */
    70   typedef unsigned long int MD5UINT4;
    68   typedef unsigned long int MD5UINT4;
    71 
    69 
    72 /* Data structure for MD5 (Message-Digest) computation */
    70 /* Data structure for MD5 (Message-Digest) computation */
    73   typedef struct {
    71   typedef struct {
    74     MD5UINT4  i[2];		/* number of _bits_ handled mod 2^64 */
    72     MD5UINT4  i[2];     /* number of _bits_ handled mod 2^64 */
    75     MD5UINT4  buf[4];		/* scratch buffer */
    73     MD5UINT4  buf[4];       /* scratch buffer */
    76     unsigned char in[64];	/* input buffer */
    74     unsigned char in[64];   /* input buffer */
    77     unsigned char digest[16];	/* actual digest after Md5Final call */
    75     unsigned char digest[16];   /* actual digest after Md5Final call */
    78   } SDLTest_Md5Context;
    76   } SDLTest_Md5Context;
    79 
    77 
    80 /* ---------- Function Prototypes ------------- */
    78 /* ---------- Function Prototypes ------------- */
    81 
    79 
    82 /** 
    80 /**
    83  * /brief initialize the context
    81  * /brief initialize the context
    84  *
    82  *
    85  * /param  mdContext		pointer to context variable
    83  * /param  mdContext        pointer to context variable
    86  *
    84  *
    87  * Note: The function initializes the message-digest context
    85  * Note: The function initializes the message-digest context
    88  *       mdContext. Call before each new use of the context - 
    86  *       mdContext. Call before each new use of the context -
    89  *       all fields are set to zero.
    87  *       all fields are set to zero.
    90  */
    88  */
    91  void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
    89  void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
    92 
    90 
    93 
    91 
    94 /**
    92 /**
    95  * /brief update digest from variable length data
    93  * /brief update digest from variable length data
    96  * 
    94  *
    97  * /param  mdContext       pointer to context variable
    95  * /param  mdContext       pointer to context variable
    98  * /param  inBuf           pointer to data array/string
    96  * /param  inBuf           pointer to data array/string
    99  * /param  inLen           length of data array/string
    97  * /param  inLen           length of data array/string
   100  *
    98  *
   101  * Note: The function updates the message-digest context to account 
    99  * Note: The function updates the message-digest context to account
   102  *       for the presence of each of the characters inBuf[0..inLen-1]
   100  *       for the presence of each of the characters inBuf[0..inLen-1]
   103  *       in the message whose digest is being computed.
   101  *       in the message whose digest is being computed.
   104 */
   102 */
   105 
   103 
   106  void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
   104  void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
   107 				 unsigned int inLen);
   105                  unsigned int inLen);
   108 
   106 
   109 
   107 
   110 /*
   108 /*
   111  * /brief complete digest computation
   109  * /brief complete digest computation
   112  *
   110  *
   113  * /param mdContext		pointer to context variable
   111  * /param mdContext     pointer to context variable
   114  *
   112  *
   115  * Note: The function terminates the message-digest computation and
   113  * Note: The function terminates the message-digest computation and
   116  *       ends with the desired message digest in mdContext.digest[0..15].
   114  *       ends with the desired message digest in mdContext.digest[0..15].
   117  *       Always call before using the digest[] variable.
   115  *       Always call before using the digest[] variable.
   118 */
   116 */
   120  void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
   118  void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
   121 
   119 
   122 
   120 
   123 /* Ends C function definitions when using C++ */
   121 /* Ends C function definitions when using C++ */
   124 #ifdef __cplusplus
   122 #ifdef __cplusplus
   125 /* *INDENT-OFF* */
       
   126 }
   123 }
   127 /* *INDENT-ON* */
       
   128 #endif
   124 #endif
   129 #include "close_code.h"
   125 #include "close_code.h"
   130 
   126 
   131 #endif /* _SDL_test_md5_h */
   127 #endif /* _SDL_test_md5_h */
   132 
   128