all: use new AppendEncode methods available in Go 1.22 (#11079)
Updates #cleanup Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
+1
-9
@@ -53,18 +53,10 @@ func clamp25519Private(b []byte) {
|
||||
func appendHexKey(dst []byte, prefix string, key []byte) []byte {
|
||||
dst = slices.Grow(dst, len(prefix)+hex.EncodedLen(len(key)))
|
||||
dst = append(dst, prefix...)
|
||||
dst = hexAppendEncode(dst, key)
|
||||
dst = hex.AppendEncode(dst, key)
|
||||
return dst
|
||||
}
|
||||
|
||||
// TODO(https://go.dev/issue/53693): Use hex.AppendEncode instead.
|
||||
func hexAppendEncode(dst, src []byte) []byte {
|
||||
n := hex.EncodedLen(len(src))
|
||||
dst = slices.Grow(dst, n)
|
||||
hex.Encode(dst[len(dst):][:n], src)
|
||||
return dst[:len(dst)+n]
|
||||
}
|
||||
|
||||
// parseHex decodes a key string of the form "<prefix><hex string>"
|
||||
// into out. The prefix must match, and the decoded base64 must fit
|
||||
// exactly into out.
|
||||
|
||||
Reference in New Issue
Block a user