Index: include/libroar/hash.h
===================================================================
--- include/libroar/hash.h	(revision 4878)
+++ include/libroar/hash.h	(revision 5284)
@@ -39,44 +39,46 @@
 #include "libroar.h"
 
+typedef uint_least32_t roar_hash_t;
+
 // the hashtypes:
-#define ROAR_HT_NONE        0
-#define ROAR_HT_MD5         1
-#define ROAR_HT_SHA1        2
-#define ROAR_HT_RIPEMD160   3
-#define ROAR_HT_MD2         5
-#define ROAR_HT_TIGER       6
-#define ROAR_HT_HAVAL       7
-#define ROAR_HT_SHA256      8
-#define ROAR_HT_SHA384      9
-#define ROAR_HT_SHA512      10
-#define ROAR_HT_SHA224      11
-#define ROAR_HT_MD4         301
-#define ROAR_HT_CRC32       302
-#define ROAR_HT_RFC1510     303
-#define ROAR_HT_RFC2440     304
-#define ROAR_HT_WHIRLPOOL   305
-#define ROAR_HT_UUID        70000
-#define ROAR_HT_GTN8        70001
-#define ROAR_HT_GTN16       70002
-#define ROAR_HT_GTN32       70004
-#define ROAR_HT_GTN64       70008
-#define ROAR_HT_CLIENTID    71001
-#define ROAR_HT_STREAMID    71002
-#define ROAR_HT_SOURCEID    71003
-#define ROAR_HT_SAMPLEID    71004
-#define ROAR_HT_MIXERID     71005
-#define ROAR_HT_BRIDGEID    71006
-#define ROAR_HT_LISTENID    71007
-#define ROAR_HT_ACTIONID    71008
-#define ROAR_HT_MSGQUEUEID  71009
-#define ROAR_HT_MSGBUSID    71010
-#define ROAR_HT_GTIN8       72001
-#define ROAR_HT_GTIN13      72002
-#define ROAR_HT_ISBN10      72003
+#define ROAR_HT_NONE        ((roar_hash_t)0UL)
+#define ROAR_HT_MD5         ((roar_hash_t)1UL)
+#define ROAR_HT_SHA1        ((roar_hash_t)2UL)
+#define ROAR_HT_RIPEMD160   ((roar_hash_t)3UL)
+#define ROAR_HT_MD2         ((roar_hash_t)5UL)
+#define ROAR_HT_TIGER       ((roar_hash_t)6UL)
+#define ROAR_HT_HAVAL       ((roar_hash_t)7UL)
+#define ROAR_HT_SHA256      ((roar_hash_t)8UL)
+#define ROAR_HT_SHA384      ((roar_hash_t)9UL)
+#define ROAR_HT_SHA512      ((roar_hash_t)10UL)
+#define ROAR_HT_SHA224      ((roar_hash_t)11UL)
+#define ROAR_HT_MD4         ((roar_hash_t)301UL)
+#define ROAR_HT_CRC32       ((roar_hash_t)302UL)
+#define ROAR_HT_RFC1510     ((roar_hash_t)303UL)
+#define ROAR_HT_RFC2440     ((roar_hash_t)304UL)
+#define ROAR_HT_WHIRLPOOL   ((roar_hash_t)305UL)
+#define ROAR_HT_UUID        ((roar_hash_t)70000UL)
+#define ROAR_HT_GTN8        ((roar_hash_t)70001UL)
+#define ROAR_HT_GTN16       ((roar_hash_t)70002UL)
+#define ROAR_HT_GTN32       ((roar_hash_t)70004UL)
+#define ROAR_HT_GTN64       ((roar_hash_t)70008UL)
+#define ROAR_HT_CLIENTID    ((roar_hash_t)71001UL)
+#define ROAR_HT_STREAMID    ((roar_hash_t)71002UL)
+#define ROAR_HT_SOURCEID    ((roar_hash_t)71003UL)
+#define ROAR_HT_SAMPLEID    ((roar_hash_t)71004UL)
+#define ROAR_HT_MIXERID     ((roar_hash_t)71005UL)
+#define ROAR_HT_BRIDGEID    ((roar_hash_t)71006UL)
+#define ROAR_HT_LISTENID    ((roar_hash_t)71007UL)
+#define ROAR_HT_ACTIONID    ((roar_hash_t)71008UL)
+#define ROAR_HT_MSGQUEUEID  ((roar_hash_t)71009UL)
+#define ROAR_HT_MSGBUSID    ((roar_hash_t)71010UL)
+#define ROAR_HT_GTIN8       ((roar_hash_t)72001UL)
+#define ROAR_HT_GTIN13      ((roar_hash_t)72002UL)
+#define ROAR_HT_ISBN10      ((roar_hash_t)72003UL)
 #define ROAR_HT_ISBN13      ROAR_HT_GTIN13
-#define ROAR_HT_ADLER32     73001
+#define ROAR_HT_ADLER32     ((roar_hash_t)73001UL)
 
 struct roar_hash_cmds {
- int algo;
+ roar_hash_t algo;
  ssize_t statelen;
  ssize_t blocksize;
@@ -88,22 +90,22 @@
 };
 
-const char * roar_ht2str (const int    ht);
-int          roar_str2ht (const char * ht);
+const char * roar_ht2str (const roar_hash_t ht);
+roar_hash_t  roar_str2ht (const char  * ht);
 
-ssize_t      roar_ht_digestlen (const int    ht);
+ssize_t      roar_ht_digestlen (const roar_hash_t ht);
 
-ssize_t      roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, int ht);
+ssize_t      roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, roar_hash_t ht);
 
-int          roar_ht_is_supported(const int    ht);
+int          roar_ht_is_supported(const roar_hash_t ht);
 
 struct roar_hash_state;
 
-struct roar_hash_state * roar_hash_new(int algo);
+struct roar_hash_state * roar_hash_new(roar_hash_t algo);
 int roar_hash_free(struct roar_hash_state * state);
 int roar_hash_digest(struct roar_hash_state * state, void * digest, size_t * len);
 int roar_hash_proc(struct roar_hash_state * state, const void * data, size_t len);
 
-int roar_hash_buffer(void * digest, const void * data, size_t datalen, int algo);
-int roar_hash_salted_buffer(void * digest, const void * data, size_t datalen, int algo, const void * salt, size_t saltlen);
+int roar_hash_buffer(void * digest, const void * data, size_t datalen, roar_hash_t algo);
+int roar_hash_salted_buffer(void * digest, const void * data, size_t datalen, roar_hash_t algo, const void * salt, size_t saltlen);
 
 #endif
Index: libroar/hash.c
===================================================================
--- libroar/hash.c	(revision 5270)
+++ libroar/hash.c	(revision 5284)
@@ -46,5 +46,5 @@
 
 static const struct hashes {
- const uint_least32_t id;
+ const roar_hash_t    id;
  const char         * name;
  const ssize_t        dlen;
@@ -110,8 +110,8 @@
 };
 
-static struct roar_hash_cmds * roar_ht2cmds(const int ht) {
+static struct roar_hash_cmds * roar_ht2cmds(const roar_hash_t ht) {
  size_t i;
 
- for(i = 0; _libroar_hash_cmds[i].algo != -1; i++)
+ for(i = 0; _libroar_hash_cmds[i].algo != (roar_hash_t)-1; i++)
   if ( _libroar_hash_cmds[i].algo == ht )
    return &(_libroar_hash_cmds[i]);
@@ -121,5 +121,5 @@
 }
 
-static inline int roar_ht2gcrypt_tested (const int ht) {
+static inline int roar_ht2gcrypt_tested (const roar_hash_t ht) {
 #ifdef ROAR_HAVE_LIBGCRYPT
  const char * name;
@@ -143,8 +143,8 @@
 }
 
-const char * roar_ht2str (const int    ht) {
+const char * roar_ht2str (const roar_hash_t  ht) {
  int i;
 
- for (i = 0; _libroar_hashes[i].id != (uint_least32_t)-1; i++)
+ for (i = 0; _libroar_hashes[i].id != (roar_hash_t)-1; i++)
   if ( _libroar_hashes[i].id == ht )
    return _libroar_hashes[i].name;
@@ -154,8 +154,8 @@
 }
 
-int          roar_str2ht (const char * ht) {
+roar_hash_t      roar_str2ht (const char * ht) {
  int i;
 
- for (i = 0; _libroar_hashes[i].id != (uint_least32_t)-1; i++)
+ for (i = 0; _libroar_hashes[i].id != (roar_hash_t)-1; i++)
   if ( !strcasecmp(_libroar_hashes[i].name, ht) )
    return _libroar_hashes[i].id;
@@ -165,5 +165,5 @@
 }
 
-ssize_t      roar_ht_digestlen (const int    ht) {
+ssize_t      roar_ht_digestlen (const roar_hash_t   ht) {
  int i;
 
@@ -192,5 +192,5 @@
 }
 
-ssize_t      roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, int ht) {
+ssize_t      roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, roar_hash_t ht) {
  ssize_t slen = roar_ht_digestlen(ht);
  union {
@@ -300,5 +300,5 @@
 }
 
-int          roar_ht_is_supported(const int    ht) {
+int          roar_ht_is_supported(const roar_hash_t ht) {
  roar_crypto_init();
 
@@ -316,5 +316,5 @@
 }
 
-struct roar_hash_state * roar_hash_new(int algo) {
+struct roar_hash_state * roar_hash_new(roar_hash_t algo) {
  struct roar_hash_cmds  * cmds = roar_ht2cmds(algo);
  struct roar_hash_state * self;
@@ -397,5 +397,5 @@
 }
 
-int roar_hash_buffer(void * digest, const void * data, size_t datalen, int algo) {
+int roar_hash_buffer(void * digest, const void * data, size_t datalen, roar_hash_t algo) {
  roar_crypto_init();
 
@@ -404,5 +404,5 @@
 
 #ifdef ROAR_HAVE_LIBGCRYPT
-static inline int roar_hash_salted_buffer_gcrypt(void * digest, const void * data, size_t datalen, int algo, const void * salt, size_t saltlen) {
+static inline int roar_hash_salted_buffer_gcrypt(void * digest, const void * data, size_t datalen, roar_hash_t algo, const void * salt, size_t saltlen) {
  gcry_md_hd_t hdl;
 
@@ -434,5 +434,5 @@
 #endif
 
-int roar_hash_salted_buffer(void * digest, const void * data, size_t datalen, int algo, const void * salt, size_t saltlen) {
+int roar_hash_salted_buffer(void * digest, const void * data, size_t datalen, roar_hash_t algo, const void * salt, size_t saltlen) {
  struct roar_hash_state * state;
  size_t len;
