# Value of Prime P in shamir secret sharing

How the value of prime integer taken in Shamir's Secret sharing scheme. I have taken p which is greater than my secret and the no of shares. When i do calculation without modp then secret reconstruct happens successfully but when i do calculations modp then secret reconstruction is not happening. Below is my example Secret S=100 a1=3 a2=6 a3=7 Prime P=107 I had calculated 8 shares without modp. In this case secret 100 appears after reconstruction S1(1,116) S2(2,186) S3(3,352) S4(4,656) S5(5,1140) S6(6,1846) S7(7,2816) S8(8,4092)

But when i take f(x) mod 107 then secret doesn't appears as 100 instead some fraction value appears .Request to suggest how prime no p is selected.

• You want to use modular multiplicative inverses for division when working in the prime field, not "normal" division as used for real numbers.
– SEJPM
Dec 19 '20 at 11:24
• Without your details, we cannot help to find your mistakes, however the general rule is ;Without loss of generality, we can assume that our secret $S$ is an element of a prime finite field with order $t$ ( i.e. $t$ is a prime). Then we can set the bounds $$0 < k \le n < t \, \text{ and }\, S <t.$$ Dec 19 '20 at 11:26