From 4d456a183308bfee7bae5bc1b97e9ca4c500b58e Mon Sep 17 00:00:00 2001 From: Dwight Date: Thu, 8 Jan 2009 09:37:18 -0500 Subject: [PATCH] forgot --- util/md5.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 util/md5.hpp diff --git a/util/md5.hpp b/util/md5.hpp new file mode 100644 index 00000000000..f529147dda3 --- /dev/null +++ b/util/md5.hpp @@ -0,0 +1,18 @@ +// md5.hpp + +#pragma once + +#include "md5.h" + +typedef unsigned char md5digest[16]; + +inline void md5(const void *buf, int nbytes, md5digest digest) { + md5_state_t st; + md5_init(&st); + md5_append(&st, (const md5_byte_t *) buf, nbytes); + md5_finish(&st, digest); +} + +inline void md5(const char *str, md5digest digest) { + md5(str, strlen(str), digest); +}