summaryrefslogtreecommitdiff
path: root/internal/mapr/funcs/md5sum.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/mapr/funcs/md5sum.go')
-rw-r--r--internal/mapr/funcs/md5sum.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/mapr/funcs/md5sum.go b/internal/mapr/funcs/md5sum.go
new file mode 100644
index 0000000..e3cc7e6
--- /dev/null
+++ b/internal/mapr/funcs/md5sum.go
@@ -0,0 +1,12 @@
+package funcs
+
+import (
+ "crypto/md5"
+ "encoding/hex"
+)
+
+// Md5Sum returns the hex encoded MD5 checksum of a given input string.
+func Md5Sum(text string) string {
+ hash := md5.Sum([]byte(text))
+ return hex.EncodeToString(hash[:])
+}