summaryrefslogtreecommitdiff
path: root/utilities.go
diff options
context:
space:
mode:
authorHorus32015-03-19 16:41:39 +0100
committerHorus32015-03-19 16:41:39 +0100
commit77b167ceae8904d827571a0ba7bfa13fac28a40e (patch)
treedc320a8b89911686ebc7af79e2335968aa488e38 /utilities.go
parente14cf986a916e1a7361b058224ef3badd3aad776 (diff)
downloadfreemail-77b167ceae8904d827571a0ba7bfa13fac28a40e.tar.gz
Regression.
Diffstat (limited to 'utilities.go')
-rw-r--r--utilities.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/utilities.go b/utilities.go
new file mode 100644
index 0000000..a090ea7
--- /dev/null
+++ b/utilities.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "crypto/md5"
+ "fmt"
+ "io"
+)
+
+// Hashs and returns a string (md5)
+func Md5Hash(content string) string {
+ h := md5.New()
+ io.WriteString(h, content)
+ hash := fmt.Sprintf("%x", h.Sum(nil))
+
+ return hash
+}