This module bring weak hashes to Bunny Library. It can be used
to generate digest of short length for any other need than security.
The hash module header is lapin/hash.h.
typedef enum e_bunny_rgb
{
 
BH_MULTIPLIER,
 
BH_FNV,
 
BH_FNV_A,
 
BH_DJB2,
 
BH_SDBM,
 
BH_LOSELOSE,
 
BH_CUSTOM
}
t_bunny_rgb;
Description
  This is the list of supported hash.
H_CUSTOM or any greater value
will trigger in
bunny_hash functions calls to customable function pointers.
Some notes about specific symbols
-
BH_MULTIPLIER:
  This algorithm is efficient with strings.
-
BH_DJB2:
  Seems quite efficient in terms of collision.
-
BH_LOSELOSE:
  Checksum.
-
BH_CUSTOM:
  Hashing with this algorithm of any higher value trigger the call to
gl_bunny_my_hash.
INDEX
Description
  Generate a digest with the sent hash algorithm of data which is
of size length bytes.
Return value
Return the hash digest of the sent data.
INDEX
k
Parameters
-
t_bunny_hash hash:
  The hash algorithm sent to bunny_hash, should be greater or
equal to BH_CUSTOM. Having it here allow you to define several
custom hashes.
-
const void *data:
  The data to hash.
-
size_t length:
  The length of the data to hash in bytes.
Return value
Return the digest of data of size length with your custom algorithm.
INDEX
Description
  This function pointer type is used when
BH_CUSTOM is
sent as hash algorithm to
bunny_hash.
INDEX
Description
  Generate a digest with the sent hash algorithm of data which is
of size length bytes and store it inside target. The size of the
hash will be target_length bytes.
Parameters
-
t_bunny_hash hash:
  The algorithm to use. If BH_CUSTOM or any higher value is sent,
then gl_bunny_my_hash is called.
-
const void *data:
  The data to hash.
-
size_t length:
  The length in bytes of data.
-
void *target:
  A memory space where to write the hash.
-
size_t target_length:
  The size of the save memory space in bytes.
INDEX