package main import ( "crypto/sha256" "testing" ) func TestTagged(t *testing.T) { h := sha256.Sum256([]byte("tag")) b := append(append(h[:0:0], h[:]...), h[:]...) b = append(b, 1) if tagged("tag", []byte{1}) != sha256.Sum256(b) || tagged("tag", nil) == tagged("other", nil) { t.Fatal("domain separation") } }