Rizin
unix-like reverse engineering framework and cli tools
algo_mod255.c File Reference

Go to the source code of this file.

Functions

static void * plugin_mod255_context_new ()
 
static void plugin_mod255_context_free (void *context)
 
static RzHashSize plugin_mod255_digest_size (void *context)
 
static RzHashSize plugin_mod255_block_size (void *context)
 
static bool plugin_mod255_init (void *context)
 
static bool plugin_mod255_update (void *context, const ut8 *data, ut64 size)
 
static bool plugin_mod255_final (void *context, ut8 *digest)
 
static bool plugin_mod255_small_block (const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size)
 

Variables

RzHashPlugin rz_hash_plugin_mod255
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ plugin_mod255_block_size()

static RzHashSize plugin_mod255_block_size ( void *  context)
static

Definition at line 21 of file algo_mod255.c.

21  {
23 }
#define RZ_HASH_MOD255_BLOCK_LENGTH
Definition: mod255.h:10

References RZ_HASH_MOD255_BLOCK_LENGTH.

◆ plugin_mod255_context_free()

static void plugin_mod255_context_free ( void *  context)
static

Definition at line 13 of file algo_mod255.c.

13  {
14  free(context);
15 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130

References free().

◆ plugin_mod255_context_new()

static void* plugin_mod255_context_new ( )
static

Definition at line 9 of file algo_mod255.c.

9  {
10  return RZ_NEW0(RzMod255);
11 }
ut32 RzMod255
Definition: mod255.h:12
#define RZ_NEW0(x)
Definition: rz_types.h:284

References RZ_NEW0.

◆ plugin_mod255_digest_size()

static RzHashSize plugin_mod255_digest_size ( void *  context)
static

Definition at line 17 of file algo_mod255.c.

17  {
19 }
#define RZ_HASH_MOD255_DIGEST_SIZE
Definition: mod255.h:9

References RZ_HASH_MOD255_DIGEST_SIZE.

◆ plugin_mod255_final()

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

Definition at line 39 of file algo_mod255.c.

39  {
40  rz_return_val_if_fail(context && digest, false);
41 
42  rz_mod255_final(digest, (RzMod255 *)context);
43  return true;
44 }
bool rz_mod255_final(ut8 *digest, RzMod255 *ctx)
Definition: mod255.c:23
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108

References rz_mod255_final(), and rz_return_val_if_fail.

◆ plugin_mod255_init()

static bool plugin_mod255_init ( void *  context)
static

Definition at line 25 of file algo_mod255.c.

25  {
27 
29  return true;
30 }
bool rz_mod255_init(RzMod255 *ctx)
Definition: mod255.c:7

References rz_mod255_init(), and rz_return_val_if_fail.

◆ plugin_mod255_small_block()

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

Definition at line 46 of file algo_mod255.c.

46  {
47  rz_return_val_if_fail(data && digest, false);
49  if (!dgst) {
50  return false;
51  }
52 
53  RzMod255 ctx;
55  rz_mod255_update(&ctx, data, size);
56  rz_mod255_final(dgst, &ctx);
57 
58  *digest = dgst;
59  if (digest_size) {
60  *digest_size = RZ_HASH_MOD255_DIGEST_SIZE;
61  }
62  return true;
63 }
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_mod255_update(RzMod255 *ctx, const ut8 *data, size_t len)
Definition: mod255.c:13

References malloc(), RZ_HASH_MOD255_DIGEST_SIZE, rz_mod255_final(), rz_mod255_init(), rz_mod255_update(), and rz_return_val_if_fail.

◆ plugin_mod255_update()

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

Definition at line 32 of file algo_mod255.c.

32  {
33  rz_return_val_if_fail(context && data, false);
34 
36  return true;
37 }

References rz_mod255_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_mod255
Definition: algo_mod255.c:65
@ RZ_LIB_TYPE_HASH
Definition: rz_lib.h:82
#define RZ_VERSION
Definition: rz_version.h:8

Definition at line 81 of file algo_mod255.c.

◆ rz_hash_plugin_mod255

RzHashPlugin rz_hash_plugin_mod255
Initial value:
= {
.name = "mod255",
.license = "LGPL3",
.author = "deroad",
.support_hmac = false,
.context_new = plugin_mod255_context_new,
.context_free = plugin_mod255_context_free,
.digest_size = plugin_mod255_digest_size,
.block_size = plugin_mod255_block_size,
.small_block = plugin_mod255_small_block,
}
static RzHashSize plugin_mod255_block_size(void *context)
Definition: algo_mod255.c:21
static RzHashSize plugin_mod255_digest_size(void *context)
Definition: algo_mod255.c:17
static bool plugin_mod255_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size)
Definition: algo_mod255.c:46
static void * plugin_mod255_context_new()
Definition: algo_mod255.c:9
static bool plugin_mod255_init(void *context)
Definition: algo_mod255.c:25
static bool plugin_mod255_update(void *context, const ut8 *data, ut64 size)
Definition: algo_mod255.c:32
static bool plugin_mod255_final(void *context, ut8 *digest)
Definition: algo_mod255.c:39
static void plugin_mod255_context_free(void *context)
Definition: algo_mod255.c:13

Definition at line 65 of file algo_mod255.c.