# basic Shamir's secret sharing scheme

I have tried to look online in various sites and texts and tried to use several youtube tutorials but I still cannot grasp it correctly.

could someone please help me understand a simple case including mathematics so I could better understand it?

For simplicity's sake, there are 3 trust levels: 1, 2, 3. to recover S you need either two users from group 1, OR one user from group 1 along with three users from group 2 and five users from group 3 (offsets of 2 for simplicity).

how a secret can be shared in such a case?

if you can, please elaborate mathematically so I can better understand the words and then begin to exercise with it to understand it better.

EDIT: my attempt, i don't understand how to it, but this is what i got:

To recover a secret S:

Assume that group 1 consists of j participants, group 2 of k participants, group 3 l participants. and groups are denoted as a,b,c accordingly for clarity.

1)2 users from group 1: we needed 2 out of j so we choose one positive integer, so $$y=s_0+a_1x+a_2x^2+...a(j-2)x^{j-2}$$. to recover we use a straight line(threshold of 2) for $$(a,f(a)), (b,f(b))$$

2)A user from group 1, 3 from group 2 and 5 from group 3: $$y=s_0+a_1x+a_2x^2+...a(j-1)x^{j-1}+b_1x+b_2x^2+...+b(k-3)x^{k-3}+l_1x+l_2x^2+...+l(k-5)^{k-5}$$. it is really complicated for me, but i think that choose the following: $$(a,f(a)),(b_1,f(b_1)),...,(b_3,f(b_3)),(c_1,f(c_1)),...,(c_5,f(c_5))$$, then since $$f(x)=\sum_{i=1}^ty_i\prod\frac{x-x_j}{x_i-x_j}$$, we set x=0 to calculate the secret, $$f(0)$$, and we get: $$\frac{f(a)*b_1*b_2}{(a-b_1)(a-b_2)}+...+\frac{f(c_5)*c_3*c_4}{(c_5-c_3)(c_5-c_4)}$$

would appreciate corrections so i can fix my mistakes. thank you very much

• Did you looked at the Wikipedia pages about Secret Sharing and Shamir's secret Sharing – kelalaka Apr 20 '20 at 20:52
• @kelalaka: actually, I'm pretty sure that it's two shares for level 1, and one share for levels 2, 3... – poncho Apr 20 '20 at 22:09
• @poncho you are right. I read/wrote reversely. Also, OP needs a little arithmetic about weights. – kelalaka Apr 20 '20 at 22:18
• I won't write an answer to your problem with your specific numbers, but see this solution of mine to a question that asks "Problem: A certain military office, which is in control of a powerful missile, consists of six generals, five colonels, and four desk clerks. Describe how they would set up a Shamir scheme so that any five generals or any set of four colonels and three desk clerks or any three generals and three desk clerks can launch the missile." for ideas on how to proceed. – Dilip Sarwate Apr 21 '20 at 2:59
• Added my attempt, could you help me correct it so i can improve? – beginningcrypto Apr 21 '20 at 11:49