From bf5ad8e491b17ac89644ad8a5c1f51db3b2264b1 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 3 Feb 2023 21:14:05 -0800 Subject: [PATCH] crypto/rand: replace shift with constant It was mentioned after CL 463993 was merged that it is uncommon to use shifts for numbers other than powers of ten. Replace the shift with a base 10 constant. Change-Id: I11c90128740109a59add40ed7b680f7bcc9715ad Reviewed-on: https://go-review.googlesource.com/c/go/+/465275 Auto-Submit: Johan Brandhorst-Satzkorn Run-TryBot: Johan Brandhorst-Satzkorn Reviewed-by: Dmitri Shuralyov Reviewed-by: Brad Fitzpatrick Auto-Submit: Brad Fitzpatrick Reviewed-by: David Chase TryBot-Result: Gopher Robot --- src/crypto/rand/rand_js.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/rand/rand_js.go b/src/crypto/rand/rand_js.go index 39e8023504..d8fe81580b 100644 --- a/src/crypto/rand/rand_js.go +++ b/src/crypto/rand/rand_js.go @@ -10,7 +10,7 @@ import "syscall/js" // The maximum buffer size for crypto.getRandomValues is 65536 bytes. // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#exceptions -const maxGetRandomRead = 1 << 16 +const maxGetRandomRead = 64 << 10 var batchedGetRandom func([]byte) error -- 2.50.0