Ordo  0.3.4
Symmetric Cryptography Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
hash_functions.h File Reference

Abstraction Layer. More...

#include "ordo/primitives/hash_functions/hash_params.h"
Include dependency graph for hash_functions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ORDO_PUBLIC int hash_init (struct HASH_STATE *state, prim_t primitive, const void *params)
 
ORDO_PUBLIC void hash_update (struct HASH_STATE *state, const void *buffer, size_t len)
 
ORDO_PUBLIC void hash_final (struct HASH_STATE *state, void *digest)
 
ORDO_PUBLIC size_t hash_query (prim_t primitive, int query, size_t value)
 
ORDO_PUBLIC size_t hash_bsize (void)
 

Detailed Description

Abstraction Layer.

This abstraction layer declares all the hash functions and also makes them available to higher level modules - for a slightly more convenient wrapper to this interface, you can use digest.h.

Function Documentation

ORDO_PUBLIC int hash_init ( struct HASH_STATE *  state,
prim_t  primitive,
const void *  params 
)

Initializes a hash function state.

Parameters
[in,out]stateA hash function state.
[in]primitiveA hash function primitive.
[in]paramsHash function specific parameters.
Returns
ORDO_SUCCESS on success, else an error code.
ORDO_PUBLIC void hash_update ( struct HASH_STATE *  state,
const void *  buffer,
size_t  len 
)

Updates a hash function state by appending a buffer to the message this state is to calculate the cryptographic digest of.

Parameters
[in,out]stateAn initialized hash function state.
[in]bufferA buffer to append to the message.
[in]lenThe length, in bytes, of the buffer.
Remarks
This function has the property that doing update(x) followed by update(y) is equivalent to update(x || y), where || denotes concatenation.
Passing a buffer of length zero is a no-op.
ORDO_PUBLIC void hash_final ( struct HASH_STATE *  state,
void *  digest 
)

Finalizes a hash function state, outputting the final digest.

Parameters
[in,out]stateAn initialized hash function state.
[out]digestA buffer in which to write the digest.
Remarks
The digest buffer should be as large as the hash function's digest length (unless you changed it via custom parameters).
ORDO_PUBLIC size_t hash_query ( prim_t  primitive,
int  query,
size_t  value 
)

Queries a hash function for suitable parameters.

Parameters
[in]primitiveA hash function primitive.
[in]queryA query code.
[in]valueA suggested value.
Returns
A suitable parameter of type query based on value.
See Also
query.h
ORDO_PUBLIC size_t hash_bsize ( void  )

Gets the size in bytes of a HASH_STATE.

Returns
The size in bytes of the structure.
Remarks
Binary compatibility layer.