security.go 243 B

123456789101112
  1. package objx
  2. import (
  3. "crypto/sha1"
  4. "encoding/hex"
  5. )
  6. // HashWithKey hashes the specified string using the security key
  7. func HashWithKey(data, key string) string {
  8. d := sha1.Sum([]byte(data + ":" + key))
  9. return hex.EncodeToString(d[:])
  10. }