ReactOS  0.4.14-dev-358-gbef841c
md5.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MD5_CTX
 

Typedefs

typedef unsigned int MD5_u32plus
 

Functions

void MD5_Init (MD5_CTX *ctx)
 
void MD5_Update (MD5_CTX *ctx, const void *data, unsigned long size)
 
void MD5_Final (unsigned char *result, MD5_CTX *ctx)
 

Typedef Documentation

◆ MD5_u32plus

typedef unsigned int MD5_u32plus

Definition at line 32 of file md5.h.

Function Documentation

◆ MD5_Final()

void MD5_Final ( unsigned char result,
MD5_CTX ctx 
)

Definition at line 258 of file md5.c.

259 {
260  unsigned long used, available;
261 
262  used = ctx->lo & 0x3f;
263 
264  ctx->buffer[used++] = 0x80;
265 
266  available = 64 - used;
267 
268  if (available < 8) {
269  memset(&ctx->buffer[used], 0, available);
270  body(ctx, ctx->buffer, 64);
271  used = 0;
272  available = 64;
273  }
274 
275  memset(&ctx->buffer[used], 0, available - 8);
276 
277  ctx->lo <<= 3;
278  OUT(&ctx->buffer[56], ctx->lo)
279  OUT(&ctx->buffer[60], ctx->hi)
280 
281  body(ctx, ctx->buffer, 64);
282 
283  OUT(&result[0], ctx->a)
284  OUT(&result[4], ctx->b)
285  OUT(&result[8], ctx->c)
286  OUT(&result[12], ctx->d)
287 
288  memset(ctx, 0, sizeof(*ctx));
289 }
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
GLuint buffer
Definition: glext.h:5915
MD5_u32plus lo
Definition: md5.h:35
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2336
c used
Definition: write.c:2877
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
#define OUT(dst, src)
Definition: md5.c:252
unsigned char buffer[64]
Definition: md5.h:37
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39

Referenced by FT_Render_Glyph_Internal(), generate_random(), sec_hash_16(), sec_hash_48(), sec_sign(), and sec_update().

◆ MD5_Init()

void MD5_Init ( MD5_CTX ctx)

Definition at line 207 of file md5.c.

208 {
209  ctx->a = 0x67452301;
210  ctx->b = 0xefcdab89;
211  ctx->c = 0x98badcfe;
212  ctx->d = 0x10325476;
213 
214  ctx->lo = 0;
215  ctx->hi = 0;
216 }
MD5_u32plus c
Definition: md5.h:36
MD5_u32plus lo
Definition: md5.h:35
MD5_u32plus hi
Definition: md5.h:35
MD5_u32plus d
Definition: md5.h:36
MD5_u32plus a
Definition: md5.h:36
MD5_u32plus b
Definition: md5.h:36

Referenced by FT_Render_Glyph_Internal(), generate_random(), sec_hash_16(), sec_hash_48(), sec_sign(), and sec_update().

◆ MD5_Update()

void MD5_Update ( MD5_CTX ctx,
const void data,
unsigned long  size 
)

Definition at line 218 of file md5.c.

219 {
220  MD5_u32plus saved_lo;
221  unsigned long used, available;
222 
223  saved_lo = ctx->lo;
224  if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
225  ctx->hi++;
226  ctx->hi += size >> 29;
227 
228  used = saved_lo & 0x3f;
229 
230  if (used) {
231  available = 64 - used;
232 
233  if (size < available) {
234  memcpy(&ctx->buffer[used], data, size);
235  return;
236  }
237 
238  memcpy(&ctx->buffer[used], data, available);
239  data = (const unsigned char *)data + available;
240  size -= available;
241  body(ctx, ctx->buffer, 64);
242  }
243 
244  if (size >= 64) {
245  data = body(ctx, data, size & ~(unsigned long)0x3f);
246  size &= 0x3f;
247  }
248 
249  memcpy(ctx->buffer, data, size);
250 }
MD5_u32plus lo
Definition: md5.h:35
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2336
unsigned int MD5_u32plus
Definition: md5.h:32
c used
Definition: write.c:2877
MD5_u32plus hi
Definition: md5.h:35
GLsizeiptr size
Definition: glext.h:5919
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
unsigned char buffer[64]
Definition: md5.h:37

Referenced by FT_Render_Glyph_Internal(), generate_random(), sec_hash_16(), sec_hash_48(), sec_sign(), and sec_update().