summaryrefslogtreecommitdiff
path: root/gp-scripts
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-08-19 14:12:33 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-08-19 14:12:33 +0200
commitf9f74fddd7557ba5018f5bfff4f0bdcc3e196132 (patch)
tree66c83876f4f477f68293079af96fe33db26ebaec /gp-scripts
parent25321ed0f5fa06f7c25d9e571c27c8dbeb5ffb96 (diff)
add test primes to gp script
Diffstat (limited to 'gp-scripts')
-rw-r--r--gp-scripts/firstPrice19
1 files changed, 12 insertions, 7 deletions
diff --git a/gp-scripts/firstPrice b/gp-scripts/firstPrice
index d936e36..2600e6e 100644
--- a/gp-scripts/firstPrice
+++ b/gp-scripts/firstPrice
@@ -6,9 +6,9 @@
\\\\\\\\\\\\
\\ amount of bidders
-n = 2^3
+n = 4
\\ amount of possible prices
-k = 2^7
+k = 2^4
\\ randomize bids (change to something static, if you like)
bid = vector(n,i,random(k)+1)
\\bid = vector(n,i,n-i+1) \\ first bidder wins
@@ -16,7 +16,11 @@ bid = vector(n,i,random(k)+1)
\\bid = vector(n,i,(i+1)%2) \\ second bidder wins (with ties)
\\ prime finite field setup (result may be ambiguous if your prime is too small, 4*n*k seems to work fine)
-q = prime(4*n*k)
+\\q = prime(4*n*k)
+\\ 2048bit prime:
+\\q = 31905233907400964621684499856844075173802000556075101303613351426740101897961025481077892281365444367883091980681462491724119317344478120131982416132058173572772607966572720945691237876256074322291459510766147107539260048324345382562673904236506104922357079761457605045674628331006193183908801308817507027556440703972646885207099302085383887085776295396030033300833460743425162726394704256227108175491673135830378272029374848904772902525385997099641162537271298634032011458617811670193865244028195169383991286227040469186123958053863978710424421008752927011390777187889943940479064193231486057910586526439884046593027
+\\ 3072bit prime:
+q = 5175054779340588353586849786144680366505563673837334790820581054294754700842534366479020240016540005621125885927641963390708863183739793208880756653713659686139600715884857385144475261507869935694699816011948585170171332029002674283854825650901258017026965486602158722052719421343475066067509485302858041368266332080773331946039572497794442067057597327877030322029413318847025776818839927761556478107499002213648377029201340152459685610920194363099878398871001275336711869213616313858200583491913270052111910410231060407633125816386053759634073500319223989240814564691163285769745840521560940666058800931070258886096469889796899266014106833050284032035948051974659796051419431527095503586817863043771919051402039741075037010264761045992285666560487072740505566408086913711094879155498223636912657852688296081316652278801546924079650897913388978423388839346058027184069633227966507908979049369500450630036982661231208087459099
\\\\\\\\\\\\
\\ SETUP
@@ -26,10 +30,11 @@ q = prime(4*n*k)
\\p = 47
\\ get generator / primitive element for Z_q
-var = 'x \\ copy pasta from internet
-pe=ffgen(minpoly(ffprimroot(ffgen(ffinit(q,1))),var),var) \\ get primitive element
-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
+\\ var = 'x \\ copy pasta from internet
+\\ pe=ffgen(minpoly(ffprimroot(ffgen(ffinit(q,1))),var),var) \\ get primitive element
+\\ 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(2, q)
\\\\\\\\\\\\
\\ PROLOG