Skip to content

Commit

Permalink
Only generate xCoordinates for the number of parts
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Hoffman committed Apr 20, 2017
1 parent 78ad36b commit 754c8dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shamir/shamir.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func Split(secret []byte, parts, threshold int) ([][]byte, error) {
}

// Generate random list of x coordinates
xCoordinates := mathrand.Perm(255)
xCoordinates := mathrand.Perm(parts)

// Allocate the output array, initialize the final byte
// of the output with the offset. The representation of each
Expand Down

1 comment on commit 754c8dd

@jefferai
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change means that x is in a random order but can only be one of parts values instead of 255. Is that intended (e.g. not work properly the other way) or was this just an efficiency change?

Please sign in to comment.