aboutsummaryrefslogtreecommitdiff
path: root/internal/hash.go
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2019-03-27 07:47:10 -0700
committerGitHub <noreply@github.com>2019-03-27 07:47:10 -0700
commitdcfac4d41fc50d2cf06ee3df4e03dfd66dd7e0f4 (patch)
tree7b1f1515d7e8297de14f8a2ebdfa8f4f3ae332df /internal/hash.go
parent20c08e68d1218475d6c6f3ca8ae718e1f508c696 (diff)
parentbce017f56f2413872a3a904067d6d19d173a9904 (diff)
downloadxesite-dcfac4d41fc50d2cf06ee3df4e03dfd66dd7e0f4.tar.xz
xesite-dcfac4d41fc50d2cf06ee3df4e03dfd66dd7e0f4.zip
Merge pull request #18 from Xe/reorg
Reorg
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)
+}