aboutsummaryrefslogtreecommitdiff
path: root/cmd/site/internal/hash.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/site/internal/hash.go')
-rw-r--r--cmd/site/internal/hash.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/site/internal/hash.go b/cmd/site/internal/hash.go
new file mode 100644
index 0000000..ee333da
--- /dev/null
+++ b/cmd/site/internal/hash.go
@@ -0,0 +1,14 @@
+package internal
+
+import (
+ "crypto/md5"
+ "fmt"
+)
+
+// Hash is a simple wrapper around the MD5 algorithm implementation in the
+// Go standard library. It takes in data and a salt and returns the hashed
+// representation.
+func Hash(data string, salt string) string {
+ output := md5.Sum([]byte(data + salt))
+ return fmt.Sprintf("%x", output)
+}