]> Cypherpunks repositories - gostls13.git/commit
math/rand/v2: add ChaCha8
authorRuss Cox <rsc@golang.org>
Thu, 30 Nov 2023 17:25:43 +0000 (12:25 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 5 Dec 2023 20:32:54 +0000 (20:32 +0000)
commitd92434935f1b6af5ece81cf13171dbe216df6254
treef9488a079b9bb251a1782a85796f5b219d7f51ff
parent6d7b3c8cd15794811949bb1ca12172eb35ace6ab
math/rand/v2: add ChaCha8

This is a replay of CL 516859, after its rollback in CL 543895,
with big-endian systems fixed and the tests disabled on RISC-V
since the compiler is broken there (#64285).

ChaCha8 provides a cryptographically strong generator
alongside PCG, so that people who want stronger randomness
have access to that. On systems with 128-bit vector math
assembly (amd64 and arm64), ChaCha8 runs at about the same
speed as PCG (25% slower on amd64, 2% faster on arm64).

Fixes #64284.

Change-Id: I6290bb8ace28e1aff9a61f805dbe380ccdf25b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/546020
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
api/go1.22.txt
src/go/build/deps_test.go
src/internal/chacha8rand/chacha8.go [new file with mode: 0644]
src/internal/chacha8rand/chacha8_amd64.s [new file with mode: 0644]
src/internal/chacha8rand/chacha8_arm64.s [new file with mode: 0644]
src/internal/chacha8rand/chacha8_generic.go [new file with mode: 0644]
src/internal/chacha8rand/chacha8_stub.s [new file with mode: 0644]
src/internal/chacha8rand/export_test.go [new file with mode: 0644]
src/internal/chacha8rand/rand_test.go [new file with mode: 0644]
src/math/rand/v2/chacha8.go [new file with mode: 0644]
src/math/rand/v2/chacha8_test.go [new file with mode: 0644]