shea256 / secret-sharing

A system for securely splitting secrets with Shamir's Secret Sharing Scheme
MIT License
489 stars 144 forks source link

Possibility of different primes in point generation and recovery #32

Open pawanjay176 opened 5 years ago

pawanjay176 commented 5 years ago

The secret_int_to_points function chooses a prime just greater than secret_int and num_points. The reverse function points_to_secret_int chooses a prime just greater than all the y coordinates in the shares.

Suppose the prime in the first case was 8191 (say secret_int was 5000). Its possible that the y coordinates of all points generated is less than 127. If this happens, then the prime number chosen by the points_to_secret_int function is 127 instead of 8191. Won't this lead to inconsistencies in the recovery of the original secret? Am I missing something here?