crypto/subtle: use min builtin function in XORBytes

Change-Id: Ibf57dbaaa54486823e0769714dec2e22d6c5ea9e
GitHub-Last-Rev: 31421d0668
GitHub-Pull-Request: golang/go#65748
Reviewed-on: https://go-review.googlesource.com/c/go/+/564577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
qiulaidongfeng 2024-02-16 10:24:55 +00:00 committed by Gopher Robot
parent 63dd79c07b
commit 6e5080470c
1 changed files with 1 additions and 4 deletions

View File

@ -9,10 +9,7 @@ package subtle
// If dst does not have length at least n,
// XORBytes panics without writing anything to dst.
func XORBytes(dst, x, y []byte) int {
n := len(x)
if len(y) < n {
n = len(y)
}
n := min(len(x), len(y))
if n == 0 {
return 0
}