Validus 1.0.5
192-bit OWHF
Loading...
Searching...
No Matches
Utility

Utility wrappers around the core Validus implementation. More...

Macros

#define VALIDUS_FILE_BLOCKSIZE   8192UL
 The size, in octets used to read blocks of data from a file.
#define VALIDUS_MAX_STRING   2048UL
 The maximum size, in octets of a string to hash.
#define VALIDUS_FP_FMT_SPEC    "%08" PRIx32 "%08" PRIx32 "%08" PRIx32 "%08" PRIx32 "%08" PRIx32 "%08" PRIx32
 Format specifier string for a Validus fingerprint.

Functions

bool validus_hash_string (validus_state *state, const char *string)
 Hashes a string.
bool validus_hash_mem (validus_state *state, const void *mem, size_t len)
 Hashes a block of memory.
bool validus_hash_file (validus_state *state, const char *file)
 Hashes a file.
bool validus_state_to_string (const validus_state *state, char *out, size_t len)
 Converts a validus_state to hexadecimal string form.

Detailed Description

Utility wrappers around the core Validus implementation.

Provides functions for hashing files, strings, and blocks of memory, etc.

Function Documentation

◆ validus_hash_string()

bool validus_hash_string ( validus_state * state,
const char * string )

Hashes a string.

Parameters
statePointer to a validus_state object which will contain the results of the operation upon success.
stringPointer to the string to hash. Will be read up until the first null terminator, or VALIDUS_MAX_STRING; whichever comes first.
Returns
bool true if input parameters are valid, false otherwise.

◆ validus_hash_mem()

bool validus_hash_mem ( validus_state * state,
const void * mem,
size_t len )

Hashes a block of memory.

Parameters
statePointer to a validus_state object which will contain the results of the operation upon success.
memPointer to the area of memory to hash.
lenLength of mem in octets.
Returns
bool true if input parameters are valid, false otherwise.

◆ validus_hash_file()

bool validus_hash_file ( validus_state * state,
const char * file )

Hashes a file.

Note
If a relative pathname is supplied, it shall be treated as relative to the current working directory. This may or may not be the same directory that this program resides in.
The preprocessor macro VALIDUS_FILE_BLOCKSIZE may be modified at compile time to suit your needs if the default value (8 KiB) is insufficient.
Parameters
statePointer to a validus_state object which will contain the results of the operation upon success.
fileAbsolute or relative pathname to the file to hash.
Returns
bool true if the file is opened and read successfully, false otherwise.

◆ validus_state_to_string()

bool validus_state_to_string ( const validus_state * state,
char * out,
size_t len )

Converts a validus_state to hexadecimal string form.

Parameters
statePointer to the validus_state to convert.
outPointer to a buffer to receive the formatted string.
lenThe length of out in octets. Must be at minimum 49.
Returns
bool true if input parameters are valid, and conversion succeeds, false otherwise.