File: security.go

package info (click to toggle)
golang-objx 0.0~git20150928.0.1a9d0bb-1~bpo8+1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 324 kB
  • sloc: makefile: 5
file content (14 lines) | stat: -rw-r--r-- 273 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package objx

import (
	"crypto/sha1"
	"encoding/hex"
)

// HashWithKey hashes the specified string using the security
// key.
func HashWithKey(data, key string) string {
	hash := sha1.New()
	hash.Write([]byte(data + ":" + key))
	return hex.EncodeToString(hash.Sum(nil))
}