-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecs.py
51 lines (39 loc) · 7.15 KB
/
specs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
prime_1000_digits = 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000526663
prime_100_digits = 6803041009578041472255343998486587165046117397971311544017945498106816511061681878259287033280186729
prime_10_digits = 1000000007
prime_4_digits = 5741
# This protocol has 4 parameters : p, n_lines, n_compositions and n_variables :
# During all the protocol, we count modulo p :
# (p must be prime, and should be big in practice)
p = prime_100_digits
# p = 2 is depreciated in this protocol, because x^2 = x (mod 2)
# and thus the quadratic functions become linear ...
if p == 2:
print('WARNING, p=2 is depreciated for security.')
# list of a prime numbers with 10, 20, 30 ... and 300 digits
prime_number_examples = [5915587277, 48112959837082048697, 671998030559713968361666935769, 2425967623052370772757633156976982469681, 22953686867719691230002707821868552601124472329079, 622288097498926496141095869268883999563096063592498055290461, 4669523849932130508876392554713407521319117239637943224980015676156491, 18532395500947174450709383384936679868383424444311405679463280782405796233163977, 282755483533707287054752184321121345766861480697448703443857012153264407439766013042402571, 2074722246773485207821695222107608587480996474721117292752992589912196684750549658310084416732550077, 35201546659608842026088328007565866231962578784643756647773109869245232364730066609837018108561065242031153677, 499490918065850301921197603564081112780623690273420984342968690594064612108591217229304461006005170865294466527166368851, 5452212151844264453115521770362712815300456788073870260637172006414987479914150831821202259862091373741738511579629040732909194883, 49105133753678962419391374496727457097027115514864975959094375339860082156189031654878635228598019107441653554142227931036658923353143622433, 656692050181897513638241554199181923922955921760928836766304161790553989228223793461834703506872747071705167995972707253940099469869516422893633357693, 5166566839092074458466334866571597694114460570387986357538048450432901440804868689337999823161841839689242893622491638917313351308387294478994745350551549126803, 27218343798190233889779431662111815254174074647423987223301820996324728298888643331463792254937414353096518304763345896749125106775048493507719412795029690510090142402163, 278344420100310216738042441752470108332323908618219525487053710207384771998286597135290418719526702385178365896340210957041552257518693488098683242070746473230980005141419410511409, 5077461915617371651811593607389848534613910665160223569902404065418076795944656510340577164207672426574638345121648036693344561339868694500127046808526397857391514634557427341972391976756821, 58021664585639791181184025950440248398226136069516938232493687505822471836536824298822733710342250697739996825938232641940670857624514103125986134050997697160127301547995788468137887651823707102007839, 643808006803554439230129854961492699151386107534013432918073439524138264842370630061369715394739134090922937332590384720397133335969549256322620979036686633213903952966175107096769180017646161851573147596390153,
5521712099665906221540423207019333379125265462121169655563495403888449493493629943498064604536961775110765377745550377067893607246020694972959780839151452457728855382113555867743022746090187341871655890805971735385789993, 56125680981752282333498088313568935051383833838594899821664631784577337171193624243181360054669678410455329112434552942717084003541384594864129940145043086760031292483340068923506115878221189886491132772739661669044958531131327771, 433019240910377478217373572959560109819648647016096560523769010881172869083338285573756574557395862965095016483867813043663981946477698466501451832407592327356331263124555137732393938242285782144928753919588632679050799198937132922145084847, 5781538327977828897150909166778407659250458379645823062042492461576758526757490910073628008613977550546382774775570888130029763571528699574717583228939535960234464230882573615930384979100379102915657483866755371559811718767760594919456971354184113721, 19273843521026396942423041256702416467190916480829438372892895532230844179797565880221360136918107451198911623615771273474843394785083334295101581743836650077544389834600122094987552690583700099541822627492515524020980656689705115960283286209148940535104015337, 583137007797276923956891216216022144052044091311388601652961409557516421612874571554415606746479105795833145583959622117418531166391184939066520869800857530421873250114773204354963864729386957427276448683092491947566992077136553066273207777134303397724679138833126700957, 5086108892721297009835929339049331087412133377600498095706525731544079419290039992637626003232557008471868045671565805734531518405008798786103630855429256249573600766250932791593951563236637920540300734605192611080733078597075129838788922720036116767139968333120379985886265595239, 28911710017320205966167820725313234361535259163045867986277478145081076845846493521348693253530011243988160148063424837895971948244167867236923919506962312185829914482993478947657472351461336729641485069323635424692930278888923450060546465883490944265147851036817433970984747733020522259537, 203956878356401977405765866929034577280193993314348263094772646453283062722701277632936616063144088173312372882677123879538709400158306567338328279154499698366071906766440037074217117805690872792848149112022286332144876183376326512083574821647933992961249917319836219304274280243803104015000563790123]
# from math import factorial
# prime_107707_digits = factorial(26951) + 1
# prime_23560_digits = factorial(6917) - 1
alphabet1 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
alphabet2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
alphabet1_extended = []
alphabet2_extended = []
for alphabet, alphabet_extended in [
(alphabet1, alphabet1_extended),
(alphabet2, alphabet2_extended),
]:
for u in alphabet:
alphabet_extended.append(u+"|")
for u in alphabet:
for v in alphabet:
alphabet_extended.append(u+v+"|")
for u in alphabet:
for v in alphabet:
for w in alphabet:
alphabet_extended.append(u+v+w+"|")