Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

math/big: typo in documentation for Int.Exp #38304

Closed
hallazzang opened this issue Apr 8, 2020 · 6 comments
Closed

math/big: typo in documentation for Int.Exp #38304

hallazzang opened this issue Apr 8, 2020 · 6 comments
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@hallazzang
Copy link
Contributor

go/src/math/big/int.go

Lines 467 to 473 in 97711bf

// Exp sets z = x**y mod |m| (i.e. the sign of m is ignored), and returns z.
// If m == nil or m == 0, z = x**y unless y <= 0 then z = 1. If m > 0, y < 0,
// and x and n are not relatively prime, z is unchanged and nil is returned.
//
// Modular exponentiation of inputs of a particular size is not a
// cryptographically constant-time operation.
func (z *Int) Exp(x, y, m *Int) *Int {

On line 469, it says ... x and n are not relatively prime, ... but there's no n in anywhere.
It should be m instead.

@randall77
Copy link
Contributor

While someone is here, it says both m>0 and the sign of m is ignored. That first part should probably be m != 0.

@andybons andybons added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Apr 8, 2020
@andybons andybons added this to the Unplanned milestone Apr 8, 2020
@hallazzang
Copy link
Contributor Author

@randall77 maybe just removing that (i.e. the sign of m is ignored) is fine enough?

@randall77
Copy link
Contributor

I guess it all depends on what it actually does for m<0.

@gopherbot
Copy link

Change https://golang.org/cl/227998 mentions this issue: math/big: fix typo in documentation for Int.Exp

@hallazzang
Copy link
Contributor Author

I think leaving (i.e. the sign of m is ignored) and change m > 0 to m != 0 makes much sense.

@gopherbot
Copy link

Change https://golang.org/cl/228000 mentions this issue: math/big: fix typo in documentation for Int.Exp

@golang golang locked and limited conversation to collaborators Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
4 participants