aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/transforms/hashers
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/transforms/hashers')
-rw-r--r--Source/charon/transforms/hashers/hasher.c11
-rw-r--r--Source/charon/transforms/hashers/hasher.h29
-rw-r--r--Source/charon/transforms/hashers/hasher_md5.c3
-rw-r--r--Source/charon/transforms/hashers/hasher_md5.h15
-rw-r--r--Source/charon/transforms/hashers/hasher_sha1.c3
-rw-r--r--Source/charon/transforms/hashers/hasher_sha1.h15
6 files changed, 48 insertions, 28 deletions
diff --git a/Source/charon/transforms/hashers/hasher.c b/Source/charon/transforms/hashers/hasher.c
index 983ae4bed..e71424ed3 100644
--- a/Source/charon/transforms/hashers/hasher.c
+++ b/Source/charon/transforms/hashers/hasher.c
@@ -1,7 +1,7 @@
/**
* @file hasher.c
*
- * @brief Generic interface for hash functions
+ * @brief Generic constructor for hasher_t
*
*/
@@ -26,7 +26,14 @@
#include <transforms/hashers/hasher_sha1.h>
#include <transforms/hashers/hasher_md5.h>
-
+/**
+ * mappings for hash_algorithm_t
+ */
+mapping_t hash_algorithm_m[] = {
+ {HASH_SHA1, "HASH_SHA1"},
+ {HASH_MD5, "HASH_MD5"},
+ {MAPPING_END, NULL}
+};
/*
* Described in header
diff --git a/Source/charon/transforms/hashers/hasher.h b/Source/charon/transforms/hashers/hasher.h
index 8b4699a3e..ed4e0ee8d 100644
--- a/Source/charon/transforms/hashers/hasher.h
+++ b/Source/charon/transforms/hashers/hasher.h
@@ -1,7 +1,7 @@
/**
* @file hasher.h
*
- * @brief Generic interface for hash functions
+ * @brief Interface for hasher_t.
*
*/
@@ -29,18 +29,25 @@
typedef enum hash_algorithm_t hash_algorithm_t;
/**
- * algorithms to use for hashing
+ * @brief Algorithms to use for hashing.
*/
enum hash_algorithm_t {
HASH_SHA1,
HASH_MD5
};
+/**
+ * string mappings for hash_algorithm_t
+ */
+extern mapping_t hash_algorithm_m[];
+
typedef struct hasher_t hasher_t;
/**
- * Object representing a hasher
+ * @brief Generic interface for all hash functions.
+ *
+ * @ingroup hashers
*/
struct hasher_t {
/**
@@ -51,7 +58,7 @@ struct hasher_t {
* If not, the result is written back and the hasher is reset.
*
* @warning: the hash output parameter must hold at least
- * #hash_t.get_block_size bytes.
+ * hash_t.get_block_size bytes.
*
* @param this calling hasher
* @param data data to hash
@@ -78,7 +85,7 @@ struct hasher_t {
status_t (*allocate_hash) (hasher_t *this, chunk_t data, chunk_t *hash);
/**
- * @brief get the block size of this hashing function
+ * @brief Get the block size of this hashing function.
*
* @param this calling hasher
* @return block size in bytes
@@ -86,7 +93,7 @@ struct hasher_t {
size_t (*get_block_size) (hasher_t *this);
/**
- * @brief reset the hashers state, which allows
+ * @brief Resets the hashers state, which allows
* computation of a completly new hash.
*
* @param this calling hasher
@@ -105,12 +112,14 @@ struct hasher_t {
};
/**
- * Creates a new hasher_t object
+ * @brief Generic interface to create a hasher_t.
*
- * @param hash_algorithm Algorithm to use for hashing
+ * @param hash_algorithm Algorithm to use for hashing
* @return
- * - hasher_t if successfully
- * - NULL if out of ressources
+ * - hasher_t if successfully
+ * - NULL if out of ressources
+ *
+ * @ingroup hashers
*/
hasher_t *hasher_create(hash_algorithm_t hash_algorithm);
diff --git a/Source/charon/transforms/hashers/hasher_md5.c b/Source/charon/transforms/hashers/hasher_md5.c
index bfdd96785..0011e92a2 100644
--- a/Source/charon/transforms/hashers/hasher_md5.c
+++ b/Source/charon/transforms/hashers/hasher_md5.c
@@ -1,8 +1,7 @@
/**
* @file hasher_md5.c
*
- * @brief Implementation of hasher_t interface using the
- * md5 algorithm.
+ * @brief Implementation of hasher_md5_t.
*
*/
diff --git a/Source/charon/transforms/hashers/hasher_md5.h b/Source/charon/transforms/hashers/hasher_md5.h
index d7e9124ee..9912d665c 100644
--- a/Source/charon/transforms/hashers/hasher_md5.h
+++ b/Source/charon/transforms/hashers/hasher_md5.h
@@ -1,8 +1,7 @@
/**
* @file hasher_md5.h
*
- * @brief Implementation of hasher_t interface using the
- * md5 algorithm.
+ * @brief Interface for hasher_md5_t.
*
*/
@@ -30,8 +29,10 @@
typedef struct hasher_md5_t hasher_md5_t;
/**
- * Object representing the md5 hasher
+ * @brief Implementation of hasher_t interface using the
+ * MD5 algorithm.
*
+ * @ingroup hashers
*/
struct hasher_md5_t {
@@ -42,11 +43,13 @@ struct hasher_md5_t {
};
/**
- * Creates a new hasher_md5_t object
+ * @brief Creates a new hasher_md5_t.
*
* @return
- * - hasher_md5_t if successfully
- * - NULL if out of ressources
+ * - hasher_md5_t if successfully
+ * - NULL if out of ressources
+ *
+ * @ingroup hashers
*/
hasher_md5_t *hasher_md5_create();
diff --git a/Source/charon/transforms/hashers/hasher_sha1.c b/Source/charon/transforms/hashers/hasher_sha1.c
index 75057457a..e9d27e8cb 100644
--- a/Source/charon/transforms/hashers/hasher_sha1.c
+++ b/Source/charon/transforms/hashers/hasher_sha1.c
@@ -1,8 +1,7 @@
/**
* @file hasher_sha1.c
*
- * @brief Implementation of hasher_t interface using the
- * SHA1 algorithm.
+ * @brief Implementation of hasher_sha_t.
*
*/
diff --git a/Source/charon/transforms/hashers/hasher_sha1.h b/Source/charon/transforms/hashers/hasher_sha1.h
index 1f96d5d72..446dc6561 100644
--- a/Source/charon/transforms/hashers/hasher_sha1.h
+++ b/Source/charon/transforms/hashers/hasher_sha1.h
@@ -1,8 +1,7 @@
/**
* @file hasher_sha1.h
*
- * @brief Implementation of hasher_t interface using the
- * SHA1 algorithm.
+ * @brief Interface for the hasher_sha1_t
*
*/
@@ -30,8 +29,10 @@
typedef struct hasher_sha1_t hasher_sha1_t;
/**
- * Object representing the sha1 hasher
+ * @brief Implementation of hasher_t interface using the
+ * SHA1 algorithm.
*
+ * @ingroup hashers
*/
struct hasher_sha1_t {
@@ -42,11 +43,13 @@ struct hasher_sha1_t {
};
/**
- * Creates a new hasher_sha1_t object
+ * @brief Creates a new hasher_sha1_t.
*
* @return
- * - hasher_sha1_t if successfully
- * - NULL if out of ressources
+ * - hasher_sha1_t if successfully
+ * - NULL if out of ressources
+ *
+ * @ingroup hashers
*/
hasher_sha1_t *hasher_sha1_create();