Utility wrappers around the core Validus implementation.
More...
|
|
#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.
|
Utility wrappers around the core Validus implementation.
Provides functions for hashing files, strings, and blocks of memory, etc.
◆ validus_hash_string()
| bool validus_hash_string |
( |
validus_state * | state, |
|
|
const char * | string ) |
Hashes a string.
- Parameters
-
| state | Pointer to a validus_state object which will contain the results of the operation upon success. |
| string | Pointer 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
-
| state | Pointer to a validus_state object which will contain the results of the operation upon success. |
| mem | Pointer to the area of memory to hash. |
| len | Length 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
-
| state | Pointer to a validus_state object which will contain the results of the operation upon success. |
| file | Absolute 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
-
| state | Pointer to the validus_state to convert. |
| out | Pointer to a buffer to receive the formatted string. |
| len | The length of out in octets. Must be at minimum 49. |
- Returns
- bool true if input parameters are valid, and conversion succeeds, false otherwise.