SILC_LOG_DEBUG(("Registering new hash function `%s'", hash->name));
+ /* Check for existing */
+ if (silc_hash_list) {
+ SilcHashObject *entry;
+ silc_dlist_start(silc_hash_list);
+ while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
+ if (!strcmp(entry->name, hash->name))
+ return FALSE;
+ }
+ }
+
new = silc_calloc(1, sizeof(*new));
new->name = strdup(hash->name);
new->hash_len = hash->hash_len;
/* Returns the length of the hash digest. */
-uint32 silc_hash_len(SilcHash hash)
+SilcUInt32 silc_hash_len(SilcHash hash)
{
return hash->hash->hash_len;
}
/* Creates the hash value and returns it to the return_hash argument. */
void silc_hash_make(SilcHash hash, const unsigned char *data,
- uint32 len, unsigned char *return_hash)
+ SilcUInt32 len, unsigned char *return_hash)
{
hash->hash->init(hash->context);
hash->hash->update(hash->context, (unsigned char *)data, len);
caller. */
char *silc_hash_fingerprint(SilcHash hash, const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcHash new_hash = NULL;
unsigned char h[32];
fingerprint to the babbleprint. */
char *silc_hash_babbleprint(SilcHash hash, const unsigned char *data,
- uint32 data_len)
+ SilcUInt32 data_len)
{
SilcHash new_hash = NULL;
char *babbleprint;