package seal import ( "crypto/hmac" "encoding/hex" ) // Fingerprint is a keyed, stable digest: equal values give equal // fingerprints and nothing else can be learned from one. An address is // enumerable, so a plain hash of it is the address in another alphabet; // HMAC under a purpose key is not. func (s *Sealer) Fingerprint(purpose, value string) (string, error) { key, err := s.purposeKey(purpose) if err != nil { return "", err } mac := hmac.New(sha256New, key) mac.Write([]byte(value)) return hex.EncodeToString(mac.Sum(nil)), nil }