Standard library / crypto/rsa
crypto/rsa.PrivateKey.Precompute()
Populates acceleration values. Do not mutate them or call concurrently with key use; generation already precomputes. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (priv *PrivateKey) Precompute()Working Example
Example Snippetgo
package main
import ( "crypto/rand" "crypto/rsa" "fmt")
func main() { k := must(rsa.GenerateKey(rand.Reader, 2048)) k.Precompute() fmt.Println(k.Precomputed.Dp != nil)}func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}