Shamir Secret Sharing (SSS)With secret sharing we take a secret value and then share it with others. For example we might have a share for Bob, Alice, Carol and Dave and then for three of them to come together to bring their shares together. For an any 3-from-4, we can use a quadratic equation, such as \(f(x)=20 x^2 - 2 x + 10\), and where the value of 10 is the secret. Bob then gets the value of \(f(x)\) when \(x=0\). This can be defined as \(f(1)\). Carol gets \(f(2)\), Dave gets \(f(3)\) and Alice gets \(f(4)\). The secret value is thus \(f(0)\). They then each know a point on the quadratic equation, and three of them can bring then back to recover the secret. In this case we will generate a random polynomial of \(a x^2 + b x + secret\), and then distribute the shares to Bob, Alice, Carol and Dave. Finally we will recover the secret from three of these shares (Bob, Carol and Dave) [article]. [Secret shares with CRT (Asmuth-Bloom threshold)][Secret shares with CRT (Mignotte threshold )][Secret shares with Blakley method][Shamir's Secret Sharing][Proactive Secret Sharing] OutlineWith secret sharing we take a secret value and then share it with others. For example we might have a share for Bob, Alice, Carol and Dave and then for three of them to come together to bring their shares together. For an any 3-from-4, we can use a quadratic equation, such as \(f(x)=20 x^2 - 2 x + 10\), and where the value of 10 is the secret. Bob then gets the value of \(f(x)\) when \(x=0\). This can be defined as \(f(1)\). Carol gets \(f(2)\), Dave gets \(f(3)\) and Alice gets \(f(4)\). The secret value is thus \(f(0)\). They then each know a point on the quadratic equation, and three of them can bring then back to recover the secret. In this case we will generate a random polynomial of \(a x^2 + b x + secret\), and then distribute the shares to Bob, Alice, Carol and Dave. Finally we will recover the secret from three of these shares (Bob, Carol and Dave). CodeIn this case we use Numpy to generate the polynomial, and also recover it: import numpy as np import random import sys a = random.randint(-20,20) b = random.randint(-20,20) secret = 10 if (len(sys.argv)>1): secret=int(sys.argv[1]) seq = [a,b,secret] f = np.poly1d(seq) print ("Secret equation:\n",f) print ("\nSecret: ",f(0)) print ("Bob: ",f(1)) print ("Carol: ",f(2)) print ("Dave: ",f(3)) print ("Alice: ",f(4)) x=[1,2,3] y=[f(1),f(2),f(3)] res=np.polyfit(x,y,2) print ("\nSecret equation: ",res) print ("Secret: ",int(round(res[2],0))) A sample run with a secret of 10 and a secret equation of \(20x^2- 19x +10\) is: Secret equation: 2 20 x - 19 x + 10 Secret: 10 Bob: 11 Carol: 52 Dave: 133 Alice: 254 Secret equation: [ 20. -19. 10.] Secret: 10 Presentation |