aboutsummaryrefslogtreecommitdiff
path: root/internal/hash.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hash.go')
-rw-r--r--internal/hash.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/hash.go b/internal/hash.go
new file mode 100644
index 0000000..ee333da
--- /dev/null
+++ b/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)
+}