diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-08 13:04:53 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-08 13:04:53 +0200 |
commit | 8cf93a6c188d6a726bce46aa987c11611cf2baac (patch) | |
tree | 8272a5421243961f4fd73cd6915f500aa25c502c | |
parent | 885b37bac1856c25d781b94eac88c03aef4e4a2b (diff) | |
download | libbrandt-8cf93a6c188d6a726bce46aa987c11611cf2baac.tar.gz libbrandt-8cf93a6c188d6a726bce46aa987c11611cf2baac.zip |
cleanup gp scripts
-rw-r--r-- | gp-scripts/firstPrice (renamed from firstPrice.gp) | 15 | ||||
-rw-r--r-- | gp-scripts/smc.gp (renamed from smc.gp) | 0 |
2 files changed, 4 insertions, 11 deletions
diff --git a/firstPrice.gp b/gp-scripts/firstPrice index 6935ab6..d936e36 100644 --- a/firstPrice.gp +++ b/gp-scripts/firstPrice | |||
@@ -31,11 +31,6 @@ pe=ffgen(minpoly(ffprimroot(ffgen(ffinit(q,1))),var),var) \\ get primitive ele | |||
31 | 1/(fforder(pe) == q-1) \\ error out, if ord(pe) is wrong | 31 | 1/(fforder(pe) == q-1) \\ error out, if ord(pe) is wrong |
32 | g = Mod(eval(Str(pe)), q) \\ dirty hack to convert t_FFELEM to t_INT | 32 | g = Mod(eval(Str(pe)), q) \\ dirty hack to convert t_FFELEM to t_INT |
33 | 33 | ||
34 | \\ setup static matrices | ||
35 | U = matrix(k,k,i,j,Mod(i<=j,q)) | ||
36 | L = matrix(k,k,i,j,Mod(i>=j,q)) | ||
37 | Id = matrix(k,k,i,j,Mod(i==j,q)) | ||
38 | |||
39 | \\\\\\\\\\\\ | 34 | \\\\\\\\\\\\ |
40 | \\ PROLOG | 35 | \\ PROLOG |
41 | \\\\\\\\\\\\ | 36 | \\\\\\\\\\\\ |
@@ -47,13 +42,11 @@ yshares = vector(n,i,g^x[i]) | |||
47 | \\ shared public key | 42 | \\ shared public key |
48 | y = prod(X=1,n,yshares[X]) | 43 | y = prod(X=1,n,yshares[X]) |
49 | 44 | ||
50 | \\ what is m? | 45 | \\ first index level = owning agent id (additive share) |
51 | \\ first index level = agent id (additive share) | ||
52 | \\ second index level = agent id, price id | 46 | \\ second index level = agent id, price id |
53 | m = vector(n,i,matrix(n,k,a,b,random(q))) | 47 | m = vector(n,i,matrix(n,k,a,b,random(q))) |
54 | 48 | ||
55 | \\ what is r? | 49 | \\ index = owning agent id, price id |
56 | \\ index = agent id, price id | ||
57 | r = matrix(n,k,i,j,random(q)) | 50 | r = matrix(n,k,i,j,random(q)) |
58 | \\ bid matrix | 51 | \\ bid matrix |
59 | b = matrix(n,k,i,j,g^(bid[i]==j)) | 52 | b = matrix(n,k,i,j,g^(bid[i]==j)) |
@@ -71,7 +64,7 @@ beta = matrix(n,k,i,j, g^r[i,j]) | |||
71 | \\\\\\\\\\\\ | 64 | \\\\\\\\\\\\ |
72 | 65 | ||
73 | \\ multiplicative shares | 66 | \\ multiplicative shares |
74 | \\ first index level = agent id (multiplicative share) | 67 | \\ first index level = owning agent id (multiplicative share) |
75 | \\ second index level = agent id, price id | 68 | \\ second index level = agent id, price id |
76 | 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] )) | 69 | 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] )) |
77 | 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] )) | 70 | 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 | |||
81 | \\\\\\\\\\\\ | 74 | \\\\\\\\\\\\ |
82 | 75 | ||
83 | \\ multiplicative shares (decryption) | 76 | \\ multiplicative shares (decryption) |
84 | \\ first index level = agent id (multiplicative share) | 77 | \\ first index level = owning agent id (multiplicative share) |
85 | \\ second index level = agent id, price id | 78 | \\ second index level = agent id, price id |
86 | Phi = vector(n,a,matrix(n,k,i,j, prod(h=1,n,Delta[h][i,j])^x[a] )) | 79 | Phi = vector(n,a,matrix(n,k,i,j, prod(h=1,n,Delta[h][i,j])^x[a] )) |
87 | 80 | ||
diff --git a/smc.gp b/gp-scripts/smc.gp index 2b7e188..2b7e188 100644 --- a/smc.gp +++ b/gp-scripts/smc.gp | |||