summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 38623dc79..931cc66fb 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -47,6 +47,7 @@
#include "glusterfs.h"
#include "stack.h"
#include "globals.h"
+#include "md5.h"
typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size);
typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size);
@@ -1711,3 +1712,16 @@ uuid_utoa_r (uuid_t uuid, char *dst)
uuid_unparse (uuid, dst);
return dst;
}
+
+void _get_md5_str (char *out_str, size_t outlen,
+ const uint8_t *input, int n)
+{
+ uint8_t out[MD5_DIGEST_LEN] = {0};
+ int j = 0;
+
+ GF_ASSERT (outlen >= (2*MD5_DIGEST_LEN + 1));
+ get_md5 (out, input, n);
+ for (j = 0; j < MD5_DIGEST_LEN; j++)
+ snprintf(out_str + j * 2, outlen-j*2, "%02x", out[j]);
+
+}