-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Randomizing x coordinate in shamir split #2621
Conversation
shamir/shamir.go
Outdated
@@ -166,13 +167,16 @@ func Split(secret []byte, parts, threshold int) ([][]byte, error) { | |||
return nil, fmt.Errorf("cannot split an empty secret") | |||
} | |||
|
|||
// Generate random list of x coordinates | |||
xCoordinates := mathrand.Perm(255) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know about rand.Perm
-- neat!
LGTM. Adding @armon for an extra look since he handled the original code. |
Good catch. It was an efficiency change but I also forgot the original intent of the change. Back to 255. |
My only concern is using |
@chrishoffman If the permutation you get back is always consistently ordered, it makes it easy to map backwards to the actual lower bound. At the least, |
Thanks @armon for bringing this to my attention. It looks like I made a bad assumption about automatic seeding in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nicely done.
Fixes #2608