Home > Software engineering >  Shamir's Secret Sharing doesn't work with large ints
Shamir's Secret Sharing doesn't work with large ints

Time:12-14

I am to use a Python example of Shamir's Secret Sharing from Wikipedia. When I give it number a larger than 170.141.183.460.469.231.731.687.303.715.884.105.726 it gives completely different output.

Why doesn't it work after that number and is there a way to get around this?

CodePudding user response:

The reason why is that all calculations are happening modulo 2 ** 127 - 1 which is 170,141,183,460,469,231,731,687,303,715,884,105,727.

Replace the line:

_PRIME = 2 ** 127 - 1

with a larger prime to increase the limit. They suggest

_PRIME = 2**521 - 1
  • Related