Rizin
unix-like reverse engineering framework and cli tools
algo_md4.c File Reference
#include <rz_hash.h>
#include <rz_util/rz_assert.h>
#include "../algorithms/md4/md4.h"

Go to the source code of this file.

Functions

static void * plugin_md4_context_new ()
 
static void plugin_md4_context_free (void *context)
 
static RzHashSize plugin_md4_digest_size (void *context)
 
static RzHashSize plugin_md4_block_size (void *context)
 
static bool plugin_md4_init (void *context)
 
static bool plugin_md4_update (void *context, const ut8 *data, ut64 size)
 
static bool plugin_md4_final (void *context, ut8 *digest)
 
static bool plugin_md4_small_block (const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size)
 

Variables

RzHashPlugin rz_hash_plugin_md4
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ plugin_md4_block_size()

static RzHashSize plugin_md4_block_size ( void *  context)
static

Definition at line 34 of file algo_md4.c.

34  {
36 }
#define RZ_HASH_MD4_BLOCK_LENGTH
Definition: md4.h:10

References RZ_HASH_MD4_BLOCK_LENGTH.

◆ plugin_md4_context_free()

static void plugin_md4_context_free ( void *  context)
static

Definition at line 26 of file algo_md4.c.

26  {
27  free(context);
28 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130

References free().

◆ plugin_md4_context_new()

static void* plugin_md4_context_new ( )
static

Use Rizin implementation, not OpenSSL lib

Definition at line 22 of file algo_md4.c.

22  {
23  return RZ_NEW0(RzMD4);
24 }
#define RZ_NEW0(x)
Definition: rz_types.h:284
Definition: md4.h:11

References RZ_NEW0.

◆ plugin_md4_digest_size()

static RzHashSize plugin_md4_digest_size ( void *  context)
static

Definition at line 30 of file algo_md4.c.

30  {
32 }
#define RZ_HASH_MD4_DIGEST_SIZE
Definition: md4.h:9

References RZ_HASH_MD4_DIGEST_SIZE.

◆ plugin_md4_final()

static bool plugin_md4_final ( void *  context,
ut8 digest 
)
static

Definition at line 52 of file algo_md4.c.

52  {
53  rz_return_val_if_fail(context && digest, false);
54 
55  rz_md4_fini(digest, (RzMD4 *)context);
56  return true;
57 }
void rz_md4_fini(ut8 *hash, RzMD4 *context)
Definition: md4.c:154
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108

References rz_md4_fini(), and rz_return_val_if_fail.

◆ plugin_md4_init()

static bool plugin_md4_init ( void *  context)
static

Definition at line 38 of file algo_md4.c.

38  {
40 
42  return true;
43 }
void rz_md4_init(RzMD4 *context)
Definition: md4.c:17

References rz_md4_init(), and rz_return_val_if_fail.

◆ plugin_md4_small_block()

static bool plugin_md4_small_block ( const ut8 data,
ut64  size,
ut8 **  digest,
RzHashSize digest_size 
)
static

Definition at line 59 of file algo_md4.c.

59  {
60  rz_return_val_if_fail(data && digest, false);
62  if (!dgst) {
63  return false;
64  }
65 
66  RzMD4 ctx;
67  rz_md4_init(&ctx);
68  rz_md4_update(&ctx, data, size);
69  rz_md4_fini(dgst, &ctx);
70 
71  *digest = dgst;
72  if (digest_size) {
73  *digest_size = RZ_HASH_MD4_DIGEST_SIZE;
74  }
75  return true;
76 }
voidpf void uLong size
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
void * malloc(size_t size)
Definition: malloc.c:123
bool rz_md4_update(RzMD4 *context, const ut8 *data, ut64 length)
Definition: md4.c:105

References malloc(), RZ_HASH_MD4_DIGEST_SIZE, rz_md4_fini(), rz_md4_init(), rz_md4_update(), and rz_return_val_if_fail.

◆ plugin_md4_update()

static bool plugin_md4_update ( void *  context,
const ut8 data,
ut64  size 
)
static

Definition at line 45 of file algo_md4.c.

45  {
46  rz_return_val_if_fail(context && data, false);
47 
48  rz_md4_update((RzMD4 *)context, data, size);
49  return true;
50 }

References rz_md4_update(), and rz_return_val_if_fail.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.version = RZ_VERSION
}
RzHashPlugin rz_hash_plugin_md4
Definition: algo_md4.c:78
@ RZ_LIB_TYPE_HASH
Definition: rz_lib.h:82
#define RZ_VERSION
Definition: rz_version.h:8

Definition at line 96 of file algo_md4.c.

◆ rz_hash_plugin_md4

RzHashPlugin rz_hash_plugin_md4
Initial value:
= {
.name = "md4",
.license = "LGPL3",
.author = "deroad",
.support_hmac = true,
.context_new = plugin_md4_context_new,
.context_free = plugin_md4_context_free,
.digest_size = plugin_md4_digest_size,
.block_size = plugin_md4_block_size,
.init = plugin_md4_init,
.update = plugin_md4_update,
.final = plugin_md4_final,
.small_block = plugin_md4_small_block,
}
static void * plugin_md4_context_new()
Definition: algo_md4.c:22
static bool plugin_md4_final(void *context, ut8 *digest)
Definition: algo_md4.c:52
static bool plugin_md4_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size)
Definition: algo_md4.c:59
static RzHashSize plugin_md4_digest_size(void *context)
Definition: algo_md4.c:30
static RzHashSize plugin_md4_block_size(void *context)
Definition: algo_md4.c:34
static bool plugin_md4_init(void *context)
Definition: algo_md4.c:38
static void plugin_md4_context_free(void *context)
Definition: algo_md4.c:26
static bool plugin_md4_update(void *context, const ut8 *data, ut64 size)
Definition: algo_md4.c:45

Definition at line 78 of file algo_md4.c.