Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: compbio
Views: 96
# thanks jasper for the script (i think) shares = [ (117, 2679694876003072088699742835831301406484), # Jack Eggleston (125, 595943668760803621234073638003526876252), # Anthony Ha (40, 3982121511713981200963183092671081758068), # Jasper Hugunin (106, 4737993754805523686979592444087285452807), # Ollin Boer Bohan (99, 2518880933522243934229518630890849836190), # Ee Suk (Isaac) Ahn (181, 2070685978337020983466401966861734322317), # Qiang (Andrew) Yu (151, 5516640695078670214986961270676482159234), # Thomas Nguyen (86, 4067270677106746468692983850678804050397), # Logan Weber (136, 4233414950621501263392080725729208937311), # Janelle Lee (169, 221686547592822529882743587614886101718), # Lane Van Elderen (77, 98947127744303534260683018483920433932), # Bader Tayeb (87, 794720497055248927703098658421393114343), # Madeline Wessels (159, 3726174313336559557490360852203459122818), # Carl Ross (101, 4144992210430546076149991633870815266025), # Tariq Amireh (80, 3460468866760839935459857781393220929855), # Michael Trinh (49, 3039321522612157650233289099937661042799), # Xi Liu (47, 1212743598907480631964612493527821316983), # Boyan Li (135, 4471468230549033221988832988889051480690), # Kevin Kitts (107, 5366566215670355992199448533206396417918), # Jackson Cannon (59, 4237804024870263863792148077321544907389), # Ian Parr (31, 274110178691095339880797297544167791681), # Eric Green (72, 5179991746522248202849220722024974622228), # May Sumner (182, 226677913044916039804223203773336044532), # Alex Zhou (89, 2748014637073324278175757059391338371543), # Marisa Yamasaki (168, 5857343216171124836695552893681097184875), # Tracy Tran (25, 2768685234256352504317366144591783365318), # Jie Du (66, 5608766395346754199213916245132828745557), # Miles Saul (9, 2240126661045466477882606894919969097501), # Natalie Andreeva (24, 676239233811051517950588382832315451226), # Garrett Deardorff (173, 2615766873705759171963214681329785450044), # Shen Wang (166, 5663936114200197872612066281976764509821), # Matthew Staehely (67, 5468844177246155482043153374827666761980), # Yifan Shao (Max) (18, 2984448354722282606162695763241458354258), # Qianying Chen (60, 5823489784324319781162429046413469697944), # Yu-Tang Peng (152, 1768107169183134571864680421600418395270), # Aishwarya Nirmal (44, 124979682244443730932964370017472050480), # Alex Kirchhoff (43, 5893119263320268534661966544731602579395), # Terry Jung (36, 2640356790223528173437078098858107832651), # Eric Ho (12, 5990912802370043361200573529292228832890), # Tyler Bonnell (14, 4667261239621445106582502421571579457986), # Gabe Carroll (50, 3311213989716012722040599075595605338026), # Royden Luckey (17, 2049460446384921381663206275718367934776), # Riley Chang (154, 4974073176875247676624283997163821126830), # Anna Pendleton (183, 3469546985286051440268339820001810556110), # Kaitlyn Zhou (11, 1306948642364875431862136416155835405325), # Anirban Biswas (143, 5681104305044998633763589149703884915473), # Shixuan Ma (103, 4584155118397224891322937719734424251999), # Kevin Bi (82, 4863103919572046928177909838826718260580), # Weilin Wan (164, 651586528999395017855392451838490706016), (127, 474679701498583488877305992026028125429) ] MOD = 5992830235524142758386850633773258681119 K = 50 if len(shares) < K: print("Needs %d more keys!" % (K-len(shares))) else: # pulled from http://ask.sagemath.org/question/8986/how-to-use-the-secret-perfect-shamir-in-sage/ F = FiniteField(MOD) # Construct finite field P = F['x'] # Polynomial ring # Convert the shares to elements of F (otherwise lagrange_polynomial will fail) shares = [(F(x), F(y)) for x,y in shares] # Now lagrange_polynomial works fine reconstructed_polynomial = P.lagrange_polynomial(shares) x = reconstructed_polynomial(0) print(x) s = str(x) print("Answer:") print(repr(''.join(chr(int(c1+c2)-10+ord('a')) for c1, c2 in zip(s[::2], s[1::2])))[1:-1])
151813132114282918122028 Answer: fiddlesticks