]> Cypherpunks repositories - gostls13.git/commit
math/big: correct documentation for ProbablyPrime.
authorAdam Langley <agl@golang.org>
Sun, 30 Aug 2015 16:21:35 +0000 (09:21 -0700)
committerAdam Langley <agl@golang.org>
Wed, 30 Sep 2015 00:39:00 +0000 (00:39 +0000)
commit5d5889c4d98e77997270ee6fa73fd02e1372573f
tree85649272d56f9faa285853ab3578af5d3aa87d51
parentbe16001187f17e9c312e69c353be743cc7d9e260
math/big: correct documentation for ProbablyPrime.

As akalin points out in the bug, the comment previously claimed that the
probability that the input is prime given that the function returned
true is 1 - ¼ⁿ. But that's wrong: the correct statement is that the
probability of the function returning false given a composite input is
1 - ¼ⁿ.

This is not nearly as helpful, but at least it's truthful. A number of
other (correct) expressions are suggested on the bug, but I think that
the simplier one is preferable.

This change also notes that the function is not suitable for
adversarial inputs since it's deterministic.

Fixes #12274.

Change-Id: I6a0871d103b126ee5a5a922a8c6993055cb7b1ed
Reviewed-on: https://go-review.googlesource.com/14052
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/math/big/int.go
src/math/big/nat.go