aboutsummaryrefslogtreecommitdiff
path: root/internal/hash.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2019-03-27 07:18:52 -0700
committerChristine Dodrill <me@christine.website>2019-03-27 07:18:52 -0700
commitd0ff1b2d04fc0caf57d99f1d34ce13cf4aae6a1a (patch)
tree29ae006563834338e663452e6f810561596582ac /internal/hash.go
parent20c08e68d1218475d6c6f3ca8ae718e1f508c696 (diff)
downloadxesite-d0ff1b2d04fc0caf57d99f1d34ce13cf4aae6a1a.tar.xz
xesite-d0ff1b2d04fc0caf57d99f1d34ce13cf4aae6a1a.zip
reorg: phase 1
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)
+}