Jul-01-2022, 07:54 AM
- I am working on project Shamir secret sharing scheme get the error
ef generateK(pShares, x_subi, Subset, q):
y_subset = []
x_subset = []
Subset.sort()
for ID in Subset:
y_i = pShares[ID]
x_i = x_subi[ID]
y_subset.append(y_i)
x_subset.append(x_i)
recoveredK = 0
for j in range(1, (len(x_subset))):
x_j = x_subset[j]
b_j = 1
for L in range(1, len(x_subset)):
if (L != j):
x_L = x_subset[L]
newCoeff = float(x_L)/(x_L - x_j)
b_j = b_j * newCoeff
recoveredK += y_subset[j] * (b_j)
recoveredK_int = int(round(recoveredK))
print(" The secret value recovered k:", recoveredK_int)
return recoveredK_intError:Enter list of Participant i secrets
10 1 3 16
Traceback (most recent call last):
File "/home/ali/Downloads/Attribute-Based-Encryption-master/LSSS_t,n.py", line 276, in <module>
runPackage([], [])
File "/home/ali/Downloads/Attribute-Based-Encryption-master/LSSS_t,n.py", line 260, in runPackage
predefinedVars, returnK = initiateScheme(predefinedVars)
File "/home/ali/Downloads/Attribute-Based-Encryption-master/LSSS_t,n.py", line 57, in initiateScheme
recovered_k = runScheme(t, n, secret_k, q, Field)
File "/home/ali/Downloads/Attribute-Based-Encryption-master/LSSS_t,n.py", line 144, in runScheme
generatedK = tryAccessStructure(k, pShares, x_subi, t_str, q)
File "/home/ali/Downloads/Attribute-Based-Encryption-master/LSSS_t,n.py", line 169, in tryAccessStructure
generatedK = generateK(pShares, x_subi, P_Subset, q)
File "/home/ali/Downloads/Attribute-Based-Encryption-master/LSSS_t,n.py", line 249, in generateK
newCoeff = float(x_L)/(x_L - x_j)
TypeError: float() argument must be a string or a number, not 'list
