github.com/coreservice-io/utils@v0.3.0/hash_util/sh256.go (about) 1 package hash_util 2 3 import ( 4 "crypto/sha256" 5 "encoding/hex" 6 ) 7 8 func SHA256(input []byte) []byte { 9 hash := sha256.Sum256(input) 10 return hash[:] 11 } 12 13 func SHA256String(input string) string { 14 hash := sha256.Sum256([]byte(input)) 15 return hex.EncodeToString(hash[:]) 16 }