Skip to content

Commit 10dbf98

Browse files
alanshawCopilot
andauthored
refactor: faster context encode
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 919409c commit 10dbf98

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

regionkey/regionkey.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ type BindingContext struct {
9898
// A DID string contains no NUL, so the separator makes the encoding
9999
// unambiguous.
100100
func bindingBytes(b BindingContext) []byte {
101-
return []byte(b.Space.String() + "\x00" + string(b.Digest))
101+
space := b.Space.String()
102+
out := make([]byte, 0, len(space)+1+len(b.Digest))
103+
out = append(out, space...)
104+
out = append(out, 0)
105+
out = append(out, b.Digest...)
106+
return out
102107
}
103108

104109
// KeyVersion identifies a specific version of a region KEK. It is stored

0 commit comments

Comments
 (0)