Rizin
unix-like reverse engineering framework and cli tools
md4.h File Reference
#include <rz_types.h>

Go to the source code of this file.

Classes

struct  RzMD4
 

Macros

#define RZ_HASH_MD4_DIGEST_SIZE   0x10
 
#define RZ_HASH_MD4_BLOCK_LENGTH   0x40
 

Functions

void rz_md4_init (RzMD4 *context)
 
bool rz_md4_update (RzMD4 *context, const ut8 *data, ut64 length)
 
void rz_md4_fini (ut8 *hash, RzMD4 *context)
 

Macro Definition Documentation

◆ RZ_HASH_MD4_BLOCK_LENGTH

#define RZ_HASH_MD4_BLOCK_LENGTH   0x40

Definition at line 10 of file md4.h.

◆ RZ_HASH_MD4_DIGEST_SIZE

#define RZ_HASH_MD4_DIGEST_SIZE   0x10

Definition at line 9 of file md4.h.

Function Documentation

◆ rz_md4_fini()

void rz_md4_fini ( ut8 hash,
RzMD4 context 
)

Definition at line 154 of file md4.c.

154  {
155  rz_return_if_fail(context && hash);
156 
158 
159  for (ut32 t = 0; t < 4; ++t) {
160  rz_write_at_le32(hash, context->digest[t], t * 4);
161  }
162 }
uint32_t ut32
void md4_padding(RzMD4 *context)
Definition: md4.c:129
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
static void rz_write_at_le32(void *dest, ut32 val, size_t offset)
Definition: rz_endian.h:261

References md4_padding(), rz_return_if_fail, and rz_write_at_le32().

Referenced by plugin_md4_final(), and plugin_md4_small_block().

◆ rz_md4_init()

void rz_md4_init ( RzMD4 context)

Definition at line 17 of file md4.c.

17  {
19 
20  context->digest[0] = 0x67452301;
21  context->digest[1] = 0xEFCDAB89;
22  context->digest[2] = 0x98BADCFE;
23  context->digest[3] = 0x10325476;
24  context->index = 0;
25  context->len_high = 0;
26  context->len_low = 0;
27 }

References rz_return_if_fail.

Referenced by plugin_md4_init(), and plugin_md4_small_block().

◆ rz_md4_update()

bool rz_md4_update ( RzMD4 context,
const ut8 data,
ut64  length 
)

Definition at line 105 of file md4.c.

105  {
106  rz_return_val_if_fail(context && data, false);
107  for (ut64 i = 0; i < length; ++i) {
108  context->block[context->index++] = data[i];
109 
110  context->len_low += 8;
111  if (context->len_low > 0xFFFFFFFFull) {
112  context->len_low &= 0xFFFFFFFFull;
113  context->len_high++;
114  // check if digested data overflows UT64
115  if (context->len_high > 0xFFFFFFFFull) {
116  return false;
117  }
118  }
119 
120  // digest only 512 bit blocks
121  if (context->index == RZ_HASH_MD4_BLOCK_LENGTH) {
123  }
124  }
125 
126  return true;
127 }
lzma_index ** i
Definition: index.h:629
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
static void md4_digest_block(RzMD4 *context)
Definition: md4.c:33
#define RZ_HASH_MD4_BLOCK_LENGTH
Definition: md4.h:10
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

References i, length, md4_digest_block(), RZ_HASH_MD4_BLOCK_LENGTH, rz_return_val_if_fail, and ut64().

Referenced by plugin_md4_small_block(), and plugin_md4_update().