Hash

include/drip/hash.h

Structures and Types

Type Name
typedef int(* drip_hash_cb_t
Callback function type for producing hashes.
typedef uint8_t drip_hash_t

Functions

Type Name
int drip_hash (const uint8_t *input, size_t input_length, drip_hash_t *hash, drip_hash_cb_t callback, void *context)
int drip_hash_to_hex (const drip_hash_t *hash, char *hex, size_t hex_size)

Macros

Type Name
define DRIP_HASH_SIZE 8

Structures and Types Documentation

typedef drip_hash_cb_t

Callback function type for producing hashes.

typedef int(* drip_hash_cb_t) (void *context, const uint8_t *input, size_t input_length, uint8_t *buffer, size_t buffer_size, size_t *output_length);

Called by drip_hash() to perform the actual hashing of the payload.

Parameters:

  • context Opaque context passed to the callback.
  • input Pointer to the payload to hash.
  • input_length Length of the payload in bytes.
  • buffer Output buffer for the hash.
  • buffer_size Size of the hash buffer in bytes.
  • output_length Receives resulting hash length written.

Return value:

  • 0 on success.
  • Non-zero on hashing failure.

typedef drip_hash_t

typedef uint8_t drip_hash_t[8];

Functions Documentation

function drip_hash

int drip_hash (
    const uint8_t *input,
    size_t input_length,
    drip_hash_t *hash,
    drip_hash_cb_t callback,
    void *context
) 

function drip_hash_to_hex

int drip_hash_to_hex (
    const drip_hash_t *hash,
    char *hex,
    size_t hex_size
) 

Macros Documentation

define DRIP_HASH_SIZE

#define DRIP_HASH_SIZE 8