aboutsummaryrefslogtreecommitdiff
path: root/hash.go
blob: ed6112c2a476f584054752a223f217de12ea9e1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package main

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)
}