#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <md5.h>
Go to the source code of this file.
|
#define | SWAP(n) (n) |
|
#define | BLOCKSIZE 4096 |
|
#define | UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0) |
|
#define | FF(b, c, d) (d ^ (b & (c ^ d))) |
|
#define | FG(b, c, d) FF (d, b, c) |
|
#define | FH(b, c, d) (b ^ c ^ d) |
|
#define | FI(b, c, d) (c ^ (b | ~d)) |
|
#define | OP(a, b, c, d, s, T) |
|
#define | OP(f, a, b, c, d, k, s, T) |
|
◆ BLOCKSIZE
Definition at line 56 of file md5.c.
◆ FF
#define FF |
( |
|
b, |
|
|
|
c, |
|
|
|
d |
|
) |
| (d ^ (b & (c ^ d))) |
◆ FG
◆ FH
#define FH |
( |
|
b, |
|
|
|
c, |
|
|
|
d |
|
) |
| (b ^ c ^ d) |
◆ FI
#define FI |
( |
|
b, |
|
|
|
c, |
|
|
|
d |
|
) |
| (c ^ (b | ~d)) |
◆ OP [1/2]
#define OP |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
s, |
|
|
|
T |
|
) |
| |
Value: do \
{ \
a +=
FF (
b,
c,
d) + (*cwp++ =
SWAP (*words)) +
T; \
++words; \
} \
while (0)
◆ OP [2/2]
Value: do \
{ \
a +=
f (
b,
c,
d) + correct_words[
k] +
T; \
} \
while (0)
◆ SWAP
Definition at line 53 of file md5.c.
◆ UNALIGNED_P
◆ md5_buffer()
void* md5_buffer |
( |
const char * |
buffer, |
|
|
size_t |
len, |
|
|
void * |
resblock |
|
) |
| |
◆ md5_finish_ctx()
void* md5_finish_ctx |
( |
struct md5_ctx * |
ctx, |
|
|
void * |
resbuf |
|
) |
| |
Definition at line 104 of file md5.c.
121 (
ctx->total[0] >> 29));
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static void pad(RzStrBuf *sb, ut32 count)
References bytes, fillbuf, md5_process_block(), md5_read_ctx(), memcpy(), pad(), and SWAP.
Referenced by cabx_close(), md5_buffer(), and md5_stream().
◆ md5_init_ctx()
void md5_init_ctx |
( |
struct md5_ctx * |
ctx | ) |
|
◆ md5_process_block()
Definition at line 301 of file md5.c.
336 #define OP(a, b, c, d, s, T) \
339 a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
354 OP (
A,
B,
C,
D, 7, 0xd76aa478);
355 OP (
D,
A,
B,
C, 12, 0xe8c7b756);
356 OP (
C,
D,
A,
B, 17, 0x242070db);
357 OP (
B,
C,
D,
A, 22, 0xc1bdceee);
358 OP (
A,
B,
C,
D, 7, 0xf57c0faf);
359 OP (
D,
A,
B,
C, 12, 0x4787c62a);
360 OP (
C,
D,
A,
B, 17, 0xa8304613);
361 OP (
B,
C,
D,
A, 22, 0xfd469501);
362 OP (
A,
B,
C,
D, 7, 0x698098d8);
363 OP (
D,
A,
B,
C, 12, 0x8b44f7af);
364 OP (
C,
D,
A,
B, 17, 0xffff5bb1);
365 OP (
B,
C,
D,
A, 22, 0x895cd7be);
366 OP (
A,
B,
C,
D, 7, 0x6b901122);
367 OP (
D,
A,
B,
C, 12, 0xfd987193);
368 OP (
C,
D,
A,
B, 17, 0xa679438e);
369 OP (
B,
C,
D,
A, 22, 0x49b40821);
375 #define OP(f, a, b, c, d, k, s, T) \
378 a += f (b, c, d) + correct_words[k] + T; \
385 OP (
FG,
A,
B,
C,
D, 1, 5, 0xf61e2562);
386 OP (
FG,
D,
A,
B,
C, 6, 9, 0xc040b340);
387 OP (
FG,
C,
D,
A,
B, 11, 14, 0x265e5a51);
388 OP (
FG,
B,
C,
D,
A, 0, 20, 0xe9b6c7aa);
389 OP (
FG,
A,
B,
C,
D, 5, 5, 0xd62f105d);
390 OP (
FG,
D,
A,
B,
C, 10, 9, 0x02441453);
391 OP (
FG,
C,
D,
A,
B, 15, 14, 0xd8a1e681);
392 OP (
FG,
B,
C,
D,
A, 4, 20, 0xe7d3fbc8);
393 OP (
FG,
A,
B,
C,
D, 9, 5, 0x21e1cde6);
394 OP (
FG,
D,
A,
B,
C, 14, 9, 0xc33707d6);
395 OP (
FG,
C,
D,
A,
B, 3, 14, 0xf4d50d87);
396 OP (
FG,
B,
C,
D,
A, 8, 20, 0x455a14ed);
397 OP (
FG,
A,
B,
C,
D, 13, 5, 0xa9e3e905);
398 OP (
FG,
D,
A,
B,
C, 2, 9, 0xfcefa3f8);
399 OP (
FG,
C,
D,
A,
B, 7, 14, 0x676f02d9);
400 OP (
FG,
B,
C,
D,
A, 12, 20, 0x8d2a4c8a);
403 OP (
FH,
A,
B,
C,
D, 5, 4, 0xfffa3942);
404 OP (
FH,
D,
A,
B,
C, 8, 11, 0x8771f681);
405 OP (
FH,
C,
D,
A,
B, 11, 16, 0x6d9d6122);
406 OP (
FH,
B,
C,
D,
A, 14, 23, 0xfde5380c);
407 OP (
FH,
A,
B,
C,
D, 1, 4, 0xa4beea44);
408 OP (
FH,
D,
A,
B,
C, 4, 11, 0x4bdecfa9);
409 OP (
FH,
C,
D,
A,
B, 7, 16, 0xf6bb4b60);
410 OP (
FH,
B,
C,
D,
A, 10, 23, 0xbebfbc70);
411 OP (
FH,
A,
B,
C,
D, 13, 4, 0x289b7ec6);
412 OP (
FH,
D,
A,
B,
C, 0, 11, 0xeaa127fa);
413 OP (
FH,
C,
D,
A,
B, 3, 16, 0xd4ef3085);
414 OP (
FH,
B,
C,
D,
A, 6, 23, 0x04881d05);
415 OP (
FH,
A,
B,
C,
D, 9, 4, 0xd9d4d039);
416 OP (
FH,
D,
A,
B,
C, 12, 11, 0xe6db99e5);
417 OP (
FH,
C,
D,
A,
B, 15, 16, 0x1fa27cf8);
418 OP (
FH,
B,
C,
D,
A, 2, 23, 0xc4ac5665);
421 OP (
FI,
A,
B,
C,
D, 0, 6, 0xf4292244);
422 OP (
FI,
D,
A,
B,
C, 7, 10, 0x432aff97);
423 OP (
FI,
C,
D,
A,
B, 14, 15, 0xab9423a7);
424 OP (
FI,
B,
C,
D,
A, 5, 21, 0xfc93a039);
425 OP (
FI,
A,
B,
C,
D, 12, 6, 0x655b59c3);
426 OP (
FI,
D,
A,
B,
C, 3, 10, 0x8f0ccc92);
427 OP (
FI,
C,
D,
A,
B, 10, 15, 0xffeff47d);
428 OP (
FI,
B,
C,
D,
A, 1, 21, 0x85845dd1);
429 OP (
FI,
A,
B,
C,
D, 8, 6, 0x6fa87e4f);
430 OP (
FI,
D,
A,
B,
C, 15, 10, 0xfe2ce6e0);
431 OP (
FI,
C,
D,
A,
B, 6, 15, 0xa3014314);
432 OP (
FI,
B,
C,
D,
A, 13, 21, 0x4e0811a1);
433 OP (
FI,
A,
B,
C,
D, 4, 6, 0xf7537e82);
434 OP (
FI,
D,
A,
B,
C, 11, 10, 0xbd3af235);
435 OP (
FI,
C,
D,
A,
B, 2, 15, 0x2ad7d2bb);
436 OP (
FI,
B,
C,
D,
A, 9, 21, 0xeb86d391);
References A, B, C, D, FG, FH, FI, len, and OP.
Referenced by md5_finish_ctx(), md5_process_bytes(), and md5_stream().
◆ md5_process_bytes()
Definition at line 216 of file md5.c.
220 if (
ctx->buflen != 0)
222 size_t left_over =
ctx->buflen;
223 size_t add = 128 - left_over >
len ?
len : 128 - left_over;
228 if (
ctx->buflen > 64)
245 #if !_STRING_ARCH_unaligned
249 # define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0)
251 # define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0)
273 size_t left_over =
ctx->buflen;
283 ctx->buflen = left_over;
References add(), len, md5_process_block(), memcpy(), and UNALIGNED_P.
Referenced by cabx_write(), md5_buffer(), and md5_stream().
◆ md5_read_ctx()
void* md5_read_ctx |
( |
const struct md5_ctx * |
ctx, |
|
|
void * |
resbuf |
|
) |
| |
◆ md5_stream()
int md5_stream |
( |
FILE * |
stream, |
|
|
void * |
resblock |
|
) |
| |
◆ fillbuf