]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/rand: replace shift with constant
authorJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Sat, 4 Feb 2023 05:14:05 +0000 (21:14 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 6 Feb 2023 18:03:38 +0000 (18:03 +0000)
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 <johan.brandhorst@gmail.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/crypto/rand/rand_js.go

index 39e8023504440af4c1da8be5ad0d1134f3f80865..d8fe81580b5f16557b226c67559448b5796549c5 100644 (file)
@@ -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