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

Go to the source code of this file.

Macros

#define RZ_HASH_MOD255_DIGEST_SIZE   4
 
#define RZ_HASH_MOD255_BLOCK_LENGTH   0
 

Typedefs

typedef ut32 RzMod255
 

Functions

bool rz_mod255_init (RzMod255 *ctx)
 
bool rz_mod255_update (RzMod255 *ctx, const ut8 *data, size_t len)
 
bool rz_mod255_final (ut8 *digest, RzMod255 *ctx)
 

Macro Definition Documentation

◆ RZ_HASH_MOD255_BLOCK_LENGTH

#define RZ_HASH_MOD255_BLOCK_LENGTH   0

Definition at line 10 of file mod255.h.

◆ RZ_HASH_MOD255_DIGEST_SIZE

#define RZ_HASH_MOD255_DIGEST_SIZE   4

Definition at line 9 of file mod255.h.

Typedef Documentation

◆ RzMod255

typedef ut32 RzMod255

Definition at line 12 of file mod255.h.

Function Documentation

◆ rz_mod255_final()

bool rz_mod255_final ( ut8 digest,
RzMod255 ctx 
)

Definition at line 23 of file mod255.c.

23  {
24  rz_return_val_if_fail(digest && ctx, false);
25  *digest = (*ctx) % 255;
26  return true;
27 }
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108

References rz_return_val_if_fail.

Referenced by plugin_mod255_final(), and plugin_mod255_small_block().

◆ rz_mod255_init()

bool rz_mod255_init ( RzMod255 ctx)

Definition at line 7 of file mod255.c.

7  {
9  *ctx = 0;
10  return true;
11 }

References rz_return_val_if_fail.

Referenced by plugin_mod255_init(), and plugin_mod255_small_block().

◆ rz_mod255_update()

bool rz_mod255_update ( RzMod255 ctx,
const ut8 data,
size_t  len 
)

Definition at line 13 of file mod255.c.

13  {
14  rz_return_val_if_fail(ctx && data, false);
15  ut8 value = *ctx;
16  for (size_t i = 0; i < len; ++i) {
17  value += data[i];
18  }
19  *ctx = value;
20  return true;
21 }
size_t len
Definition: 6502dis.c:15
lzma_index ** i
Definition: index.h:629
static int value
Definition: cmd_api.c:93
uint8_t ut8
Definition: lh5801.h:11

References i, len, rz_return_val_if_fail, and value.

Referenced by plugin_mod255_small_block(), and plugin_mod255_update().