X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilchash.h;h=dee139efdc6fa760b757c6db38ec4884a069ad3d;hb=cf7c57c5507866dab44cc92c9ee772cfc80eddbd;hp=698ce15a579cd2b5f6f924116760ed527b86e7e6;hpb=26c4ca7fbbc1e3afaa28d561f4b873a06879797e;p=silc.git diff --git a/lib/silccrypt/silchash.h b/lib/silccrypt/silchash.h index 698ce15a..dee139ef 100644 --- a/lib/silccrypt/silchash.h +++ b/lib/silccrypt/silchash.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2005 Pekka Riikonen + Copyright (C) 1997 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,8 +65,9 @@ typedef struct SilcHashStruct *SilcHash; ***/ typedef struct { char *name; - SilcUInt32 hash_len; - SilcUInt32 block_len; + char *oid; + SilcUInt16 hash_len; + SilcUInt16 block_len; void (*init)(void *); void (*update)(void *, const unsigned char *, SilcUInt32); @@ -197,6 +198,21 @@ SilcBool silc_hash_unregister_all(void); ***/ SilcBool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash); +/****f* silccrypt/SilcHashAPI/silc_hash_alloc_by_oid + * + * SYNOPSIS + * + * SilcBool silc_hash_alloc_by_oid(const char *oid, SilcHash *new_hash); + * + * DESCRIPTION + * + * Same as silc_hash_alloc but allocates the hash algorithm by the + * hash algorithm OID string indicated by `oid'. Returns FALSE if such + * hash function does not exist. + * + ***/ +SilcBool silc_hash_alloc_by_oid(const char *oid, SilcHash *new_hash); + /****f* silccrypt/SilcHashAPI/silc_hash_free * * SYNOPSIS @@ -278,6 +294,20 @@ SilcUInt32 silc_hash_block_len(SilcHash hash); ***/ const char *silc_hash_get_name(SilcHash hash); +/****f* silccrypt/SilcHashAPI/silc_hash_get_oid + * + * SYNOPSIS + * + * const char *silc_hash_get_name(SilcHash hash); + * + * DESCRIPTION + * + * Returns the hash OID string. Returns NULL if the hash doesn't have + * OID string. Use strlen() to get the OID string length. + * + ***/ +const char *silc_hash_get_oid(SilcHash hash); + /****f* silccrypt/SilcHashAPI/silc_hash_make * * SYNOPSIS