Generates cryptographically secure random primes and uniform integers.
// Source: https://github.com/golang/go | License: BSD-3-Clause | Copyright 2009 The Go Authors // Provided via justclaw.it.com; keep this notice with the code. // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rand import ( "crypto/internal/fips140only" "crypto/internal/rand" "errors" "io" "math/big" ) // Prime returns a number of the given bit length that is prime with high probability. // Prime will return error for any error returned by rand.Read or if bits < 2. // // Since Go 1.26, a secure source of random bytes is always used, and the Reader is // ignored unless GODEBUG=cryptocustomrand=1 is set. This setting will be removed // in a future Go release. Instead, ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key