From: Martin Willi Date: Sat, 26 Nov 2005 15:43:59 +0000 (-0000) Subject: - tested code-example X-Git-Tag: 4.0.0~268 X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=f1c91cf037689979049f4904fd3d76f85cd98981 - tested code-example --- diff --git a/Source/charon/definitions.h b/Source/charon/definitions.h index 03fd74b..54a8f24 100644 --- a/Source/charon/definitions.h +++ b/Source/charon/definitions.h @@ -59,9 +59,6 @@ #error "BYTE_ORDER must be defined" #endif -/** - * Doxygen namespace support - */ /** @@ -100,7 +97,31 @@ /** * @addtogroup hashers * - * Hash algorithms + * Hashing algorithms. + * + * Example for using hasher_t: + * @code + * chunk_t data; + * chunk_t md5_hash; + * u_int8_t sha1_hash[20]; + * + * hasher_t *hasher; + * + * data.ptr = "string to hash"; + * data.len = strlen(data.ptr); + * + * // use MD5, allocate hash + * hasher = hasher_create(HASH_MD5); + * hasher->allocate_hash(hasher, data, &hash); + * hasher->destroy(hasher); + * + * // use SHA1, hash in buffer + * hasher = hasher_create(HASH_SHA1); + * hasher->get_hash(hasher, data, &sha1_hash); + * hasher->destroy(hasher); + * @endcode + * + * * * @ingroup transforms */