KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CalcMD5.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "mex.h"
Include dependency graph for CalcMD5.c:

Go to the source code of this file.

Classes

struct  MD5_CTX
 

Macros

#define mwSize   int
 
#define mwIndex   int
 
#define S11   7
 
#define S12   12
 
#define S13   17
 
#define S14   22
 
#define S21   5
 
#define S22   9
 
#define S23   14
 
#define S24   20
 
#define S31   4
 
#define S32   11
 
#define S33   16
 
#define S34   23
 
#define S41   6
 
#define S42   10
 
#define S43   15
 
#define S44   21
 
#define F(x, y, z)   (((x) & (y)) | ((~x) & (z)))
 
#define G(x, y, z)   (((x) & (z)) | ((y) & (~z)))
 
#define H(x, y, z)   ((x) ^ (y) ^ (z))
 
#define I(x, y, z)   ((y) ^ ((x) | (~z)))
 
#define ROTATE_LEFT(x, n)   (((x) << (n)) | ((x) >> (32 - (n))))
 
#define FF(a, b, c, d, x, s, ac)
 
#define GG(a, b, c, d, x, s, ac)
 
#define HH(a, b, c, d, x, s, ac)
 
#define II(a, b, c, d, x, s, ac)
 
#define BUFFER_LEN   1024
 

Typedefs

typedef unsigned char UCHAR
 
typedef unsigned int UINT
 
typedef unsigned charPOINTER
 
typedef UINT32_T UINT32
 

Functions

void MD5Init (MD5_CTX *)
 
void MD5Update (MD5_CTX *, UCHAR *, UINT)
 
void MD5Final (UCHAR[16], MD5_CTX *)
 
void MD5Transform (UINT32[4], UCHAR[64])
 
void MD5Encode (UCHAR *, UINT32 *, UINT)
 
void MD5Array (UCHAR *data, mwSize N, UCHAR digest[16])
 
void MD5File (char *FileName, UCHAR digest[16])
 
void MD5Char (mxChar *data, mwSize N, UCHAR digest[16])
 
void ToHex (const UCHAR In[16], char *Out, int LowerCase)
 
void ToBase64 (const UCHAR In[16], char *Out)
 
void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
 

Variables

static UCHAR PADDING [64]
 
static UCHAR buffer [BUFFER_LEN]
 

Macro Definition Documentation

#define BUFFER_LEN   1024

Definition at line 188 of file CalcMD5.c.

Referenced by MD5Char(), and MD5File().

#define FF (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
(a) = ROTATE_LEFT((a) + F((b), (c), (d)) + (x) + (UINT32)(ac), (s)) + (b); }
#define ROTATE_LEFT(x, n)
Definition: CalcMD5.c:175
UINT32_T UINT32
Definition: CalcMD5.c:124
#define F(x, y, z)
Definition: CalcMD5.c:168

Definition at line 178 of file CalcMD5.c.

Referenced by MD5Transform().

#define G (   x,
  y,
 
)    (((x) & (z)) | ((y) & (~z)))
#define GG (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
(a) = ROTATE_LEFT((a) + G((b), (c), (d)) + (x) + (UINT32)(ac), (s)) + (b); }
#define ROTATE_LEFT(x, n)
Definition: CalcMD5.c:175
UINT32_T UINT32
Definition: CalcMD5.c:124
#define G(x, y, z)
Definition: CalcMD5.c:169

Definition at line 180 of file CalcMD5.c.

Referenced by MD5Transform().

#define H (   x,
  y,
 
)    ((x) ^ (y) ^ (z))

Definition at line 170 of file CalcMD5.c.

#define HH (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
(a) = ROTATE_LEFT((a) + H((b), (c), (d)) + (x) + (UINT32)(ac), (s)) + (b); }
#define H(x, y, z)
Definition: CalcMD5.c:170
#define ROTATE_LEFT(x, n)
Definition: CalcMD5.c:175
UINT32_T UINT32
Definition: CalcMD5.c:124

Definition at line 182 of file CalcMD5.c.

Referenced by MD5Transform().

#define II (   a,
  b,
  c,
  d,
  x,
  s,
  ac 
)
Value:
{ \
(a) = ROTATE_LEFT((a) + I((b), (c), (d)) + (x) + (UINT32)(ac), (s)) + (b); }
#define ROTATE_LEFT(x, n)
Definition: CalcMD5.c:175
#define I(x, y, z)
Definition: CalcMD5.c:171
UINT32_T UINT32
Definition: CalcMD5.c:124

Definition at line 184 of file CalcMD5.c.

Referenced by MD5Transform().

#define mwIndex   int

Definition at line 117 of file CalcMD5.c.

#define mwSize   int

Definition at line 116 of file CalcMD5.c.

#define ROTATE_LEFT (   x,
 
)    (((x) << (n)) | ((x) >> (32 - (n))))

Definition at line 175 of file CalcMD5.c.

#define S11   7

Definition at line 145 of file CalcMD5.c.

Referenced by MD5Transform().

#define S12   12

Definition at line 146 of file CalcMD5.c.

Referenced by MD5Transform().

#define S13   17

Definition at line 147 of file CalcMD5.c.

Referenced by MD5Transform().

#define S14   22

Definition at line 148 of file CalcMD5.c.

Referenced by MD5Transform().

#define S21   5

Definition at line 149 of file CalcMD5.c.

Referenced by MD5Transform().

#define S22   9

Definition at line 150 of file CalcMD5.c.

Referenced by MD5Transform().

#define S23   14

Definition at line 151 of file CalcMD5.c.

Referenced by MD5Transform().

#define S24   20

Definition at line 152 of file CalcMD5.c.

Referenced by MD5Transform().

#define S31   4

Definition at line 153 of file CalcMD5.c.

Referenced by MD5Transform().

#define S32   11

Definition at line 154 of file CalcMD5.c.

Referenced by MD5Transform().

#define S33   16

Definition at line 155 of file CalcMD5.c.

Referenced by MD5Transform().

#define S34   23

Definition at line 156 of file CalcMD5.c.

Referenced by MD5Transform().

#define S41   6

Definition at line 157 of file CalcMD5.c.

Referenced by MD5Transform().

#define S42   10

Definition at line 158 of file CalcMD5.c.

Referenced by MD5Transform().

#define S43   15

Definition at line 159 of file CalcMD5.c.

Referenced by MD5Transform().

#define S44   21

Definition at line 160 of file CalcMD5.c.

Referenced by MD5Transform().

Typedef Documentation

typedef unsigned char* POINTER

Definition at line 123 of file CalcMD5.c.

typedef unsigned char UCHAR

Definition at line 121 of file CalcMD5.c.

typedef unsigned int UINT

Definition at line 122 of file CalcMD5.c.

typedef UINT32_T UINT32

Definition at line 124 of file CalcMD5.c.

Function Documentation

void MD5Array ( UCHAR data,
mwSize  N,
UCHAR  digest[16] 
)

Definition at line 461 of file CalcMD5.c.

References MD5Final(), MD5Init(), and MD5Update().

Referenced by mexFunction().

Here is the call graph for this function:

Here is the caller graph for this function:

void MD5Char ( mxChar *  data,
mwSize  N,
UCHAR  digest[16] 
)

Definition at line 410 of file CalcMD5.c.

References buffer, BUFFER_LEN, MD5Final(), MD5Init(), and MD5Update().

Referenced by mexFunction().

Here is the call graph for this function:

Here is the caller graph for this function:

void MD5Encode ( UCHAR output,
UINT32 input,
UINT  len 
)

Definition at line 397 of file CalcMD5.c.

Referenced by MD5Final().

Here is the caller graph for this function:

void MD5File ( char FileName,
UCHAR  digest[16] 
)

Definition at line 477 of file CalcMD5.c.

References buffer, BUFFER_LEN, MD5Final(), MD5Init(), and MD5Update().

Referenced by mexFunction().

Here is the call graph for this function:

Here is the caller graph for this function:

void MD5Final ( UCHAR  digest[16],
MD5_CTX context 
)

Definition at line 244 of file CalcMD5.c.

References MD5_CTX.count, MD5Encode(), MD5Update(), PADDING, and MD5_CTX.state.

Referenced by MD5Array(), MD5Char(), and MD5File().

Here is the call graph for this function:

Here is the caller graph for this function:

void MD5Init ( MD5_CTX context)

Definition at line 192 of file CalcMD5.c.

References MD5_CTX.count, and MD5_CTX.state.

Referenced by MD5Array(), MD5Char(), and MD5File().

Here is the caller graph for this function:

void MD5Transform ( UINT32  state[4],
UCHAR  block[64] 
)

Definition at line 268 of file CalcMD5.c.

References FF, GG, HH, II, S11, S12, S13, S14, S21, S22, S23, S24, S31, S32, S33, S34, S41, S42, S43, and S44.

Referenced by MD5Update().

Here is the caller graph for this function:

void MD5Update ( MD5_CTX context,
UCHAR input,
UINT  inputLen 
)

Definition at line 205 of file CalcMD5.c.

References MD5_CTX.buffer, MD5_CTX.count, MD5Transform(), and MD5_CTX.state.

Referenced by MD5Array(), MD5Char(), MD5File(), and MD5Final().

Here is the call graph for this function:

Here is the caller graph for this function:

void mexFunction ( int  nlhs,
mxArray *  plhs[],
int  nrhs,
const mxArray *  prhs[] 
)

Definition at line 556 of file CalcMD5.c.

References MD5Array(), MD5Char(), MD5File(), ToBase64(), and ToHex().

Here is the call graph for this function:

void ToBase64 ( const UCHAR  In[16],
char Out 
)

Definition at line 526 of file CalcMD5.c.

Referenced by mexFunction().

Here is the caller graph for this function:

void ToHex ( const UCHAR  In[16],
char Out,
int  LowerCase 
)

Definition at line 508 of file CalcMD5.c.

Referenced by mexFunction().

Here is the caller graph for this function:

Variable Documentation

UCHAR buffer[BUFFER_LEN]
static

Definition at line 189 of file CalcMD5.c.

Referenced by MD5Char(), and MD5File().

UCHAR PADDING[64]
static
Initial value:
= {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }

Definition at line 162 of file CalcMD5.c.

Referenced by MD5Final().