Remove rc4.h.
[paraslash.git] / hash.h
diff --git a/hash.h b/hash.h
index 99f4486afdbfb2ecb68e636e1847ed6c7d41f100..6dfddbed69e2985b0147fe9b63d727c48cce320d 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -1,12 +1,28 @@
-#include "portable_io.h"
+/*
+ * Copyright (C) 2007-2011 Andre Noll <maan@systemlinux.org>
+ *
+ * Licensed under the GPL v2. For licencing details see COPYING.
+ */
+
+/** \file hash.h Inline functions for hash values. */
+
+/** hash arrays are always unsigned char. */
 #define HASH_TYPE unsigned char
 
-//#include "super_fast_hash.h"
-//#define hash_function super_fast_hash
 #include "sha1.h"
+/** We use openssl's sha1 implementation. */
 #define hash_function sha1_hash
 
-static inline int hash_compare(HASH_TYPE *h1, HASH_TYPE *h2)
+/**
+ * Compare two hashes.
+ *
+ * \param h1 Pointer to the first hash value.
+ * \param h2 Pointer to the second hash value.
+ *
+ * \return 1, -1, or zero, depending on whether \a h1 is greater than,
+ * less than or equal to h2, respectively.
+ */
+_static_inline_ int hash_compare(HASH_TYPE *h1, HASH_TYPE *h2)
 {
        int i;
 
@@ -19,7 +35,17 @@ static inline int hash_compare(HASH_TYPE *h1, HASH_TYPE *h2)
        return 0;
 }
 
-static inline void hash_to_asc(HASH_TYPE *hash, char *asc)
+/**
+ * Convert a hash value to ascii format.
+ *
+ * \param hash the hash value.
+ * \param asc Result pointer.
+ *
+ * \a asc must point to an area of at least 2 * \p HASH_SIZE + 1 bytes which
+ * will be filled by the function with the ascii representation of the hash
+ * value given by \a hash, and a terminating \p NULL byte.
+ */
+_static_inline_ void hash_to_asc(HASH_TYPE *hash, char *asc)
 {
        int i;
        const char hexchar[] = "0123456789abcdef";