From: Johan Brandhorst-Satzkorn Date: Sat, 4 Feb 2023 05:14:05 +0000 (-0800) Subject: crypto/rand: replace shift with constant X-Git-Tag: go1.21rc1~1640 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bf5ad8e491b17ac89644ad8a5c1f51db3b2264b1;p=gostls13.git 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 --- 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