cleanup gp scripts

This commit is contained in:
Markus Teich 2016-06-08 13:04:53 +02:00
parent 885b37bac1
commit 8cf93a6c18
2 changed files with 4 additions and 11 deletions

View File

@ -31,11 +31,6 @@ pe=ffgen(minpoly(ffprimroot(ffgen(ffinit(q,1))),var),var) \\ get primitive ele
1/(fforder(pe) == q-1) \\ error out, if ord(pe) is wrong 1/(fforder(pe) == q-1) \\ error out, if ord(pe) is wrong
g = Mod(eval(Str(pe)), q) \\ dirty hack to convert t_FFELEM to t_INT g = Mod(eval(Str(pe)), q) \\ dirty hack to convert t_FFELEM to t_INT
\\ setup static matrices
U = matrix(k,k,i,j,Mod(i<=j,q))
L = matrix(k,k,i,j,Mod(i>=j,q))
Id = matrix(k,k,i,j,Mod(i==j,q))
\\\\\\\\\\\\ \\\\\\\\\\\\
\\ PROLOG \\ PROLOG
\\\\\\\\\\\\ \\\\\\\\\\\\
@ -47,13 +42,11 @@ yshares = vector(n,i,g^x[i])
\\ shared public key \\ shared public key
y = prod(X=1,n,yshares[X]) y = prod(X=1,n,yshares[X])
\\ what is m? \\ first index level = owning agent id (additive share)
\\ first index level = agent id (additive share)
\\ second index level = agent id, price id \\ second index level = agent id, price id
m = vector(n,i,matrix(n,k,a,b,random(q))) m = vector(n,i,matrix(n,k,a,b,random(q)))
\\ what is r? \\ index = owning agent id, price id
\\ index = agent id, price id
r = matrix(n,k,i,j,random(q)) r = matrix(n,k,i,j,random(q))
\\ bid matrix \\ bid matrix
b = matrix(n,k,i,j,g^(bid[i]==j)) b = matrix(n,k,i,j,g^(bid[i]==j))
@ -71,7 +64,7 @@ beta = matrix(n,k,i,j, g^r[i,j])
\\\\\\\\\\\\ \\\\\\\\\\\\
\\ multiplicative shares \\ multiplicative shares
\\ first index level = agent id (multiplicative share) \\ first index level = owning agent id (multiplicative share)
\\ second index level = agent id, price id \\ second index level = agent id, price id
Gamma = vector(n,a,matrix(n,k,i,j, ( prod(h=1,n,prod(d=j+1,k,alpha[h,d])) * prod(d=1,j-1,alpha[i,d]) * prod(h=1,i-1,alpha[h,j]) )^m[a][i,j] )) Gamma = vector(n,a,matrix(n,k,i,j, ( prod(h=1,n,prod(d=j+1,k,alpha[h,d])) * prod(d=1,j-1,alpha[i,d]) * prod(h=1,i-1,alpha[h,j]) )^m[a][i,j] ))
Delta = vector(n,a,matrix(n,k,i,j, ( prod(h=1,n,prod(d=j+1,k, beta[h,d])) * prod(d=1,j-1, beta[i,d]) * prod(h=1,i-1, beta[h,j]) )^m[a][i,j] )) Delta = vector(n,a,matrix(n,k,i,j, ( prod(h=1,n,prod(d=j+1,k, beta[h,d])) * prod(d=1,j-1, beta[i,d]) * prod(h=1,i-1, beta[h,j]) )^m[a][i,j] ))
@ -81,7 +74,7 @@ Delta = vector(n,a,matrix(n,k,i,j, ( prod(h=1,n,prod(d=j+1,k, beta[h,d])) * prod
\\\\\\\\\\\\ \\\\\\\\\\\\
\\ multiplicative shares (decryption) \\ multiplicative shares (decryption)
\\ first index level = agent id (multiplicative share) \\ first index level = owning agent id (multiplicative share)
\\ second index level = agent id, price id \\ second index level = agent id, price id
Phi = vector(n,a,matrix(n,k,i,j, prod(h=1,n,Delta[h][i,j])^x[a] )) Phi = vector(n,a,matrix(n,k,i,j, prod(h=1,n,Delta[h][i,j])^x[a] ))