summaryrefslogtreecommitdiff
path: root/include/ouroboros/hash.h
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-04-16 12:04:59 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-04-16 13:40:12 +0200
commit97ef24340da7d3f55a39ba16b400d13f9bbe9e60 (patch)
treee13656c267343db47a4f79d2098222909222736d /include/ouroboros/hash.h
parentc884fb9d6b3d3ea59f5fc7c5d709bfff4fcf1849 (diff)
downloadouroboros-97ef24340da7d3f55a39ba16b400d13f9bbe9e60.tar.gz
ouroboros-97ef24340da7d3f55a39ba16b400d13f9bbe9e60.zip
ipcpd: Allow specifying the hash algorithm to use
Currently CRC32, MD5, and SHA3 (224, 256, 384 and 512 bit) are supported.
Diffstat (limited to 'include/ouroboros/hash.h')
-rw-r--r--include/ouroboros/hash.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/ouroboros/hash.h b/include/ouroboros/hash.h
index a94b37ee..60bfbe30 100644
--- a/include/ouroboros/hash.h
+++ b/include/ouroboros/hash.h
@@ -28,6 +28,15 @@
#include <ouroboros/md5.h>
#include <ouroboros/sha3.h>
+enum hash_algo {
+ HASH_CRC32 = 0,
+ HASH_MD5,
+ HASH_SHA3_224,
+ HASH_SHA3_256,
+ HASH_SHA3_384,
+ HASH_SHA3_512
+};
+
#define HASH_FMT "%02x%02x%02x%02x"
#define HASH_VAL(hash) \
((*(unsigned int *) hash) & 0xFF000000) >> 24, \
@@ -35,8 +44,10 @@
((*(unsigned int *) hash) & 0x0000FF00) >> 8, \
((*(unsigned int *) hash) & 0x000000FF)
-/* FIXME: Implement specifying algorithm */
-void get_hash(uint8_t buf[],
- const char * name);
+uint16_t hash_len(enum hash_algo algo);
+
+void str_hash(enum hash_algo algo,
+ void * buf,
+ const char * str);
#endif /* OUROBOROS_LIB_HASH_H */