This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDVJFD6p0LmN/MHJSIsCXvErqETYp8zF59WCSttQMD2C+yoli+LiiwPBn+AuWfGY0tlNsF7vR2TeRjy61agxNjQk2m6MmwjjAf8F9RjVI8uyoyCCYNSKagDBndqwSw0KKyhgwkDPJvwX7vDCt1ar4+VuJpdk7Bkv6XYFOrY/y2/xKWlrDf32MdNtwJqa68WuWUDbyGFtPSUJ/GlAvVhrEpjE/IUq544zM20niFU9wsLWzYEaesLIOB4WEqjlz5hM8xRbBXh2smHuWYkj5PBM48N9kJfEBJkMoIqV9jF630ZX7ce0Knj6YKMvHMVcxKlk3OHybrM66NDx4xYHStu0YkPgj8jVTL/cgLDh+JVOHdw83q2Hg+PffnfCy67dDaHbNirNlfTboSRyweOJJis5shFIxJcsWyM+dTDOn4agp1kdvsmfQH0WqRWg/j3Eno/HURVORCMahsnzuJFiT59WJ2Fq1S0YFlP4E0oySwNrwVeOpHwtU8cLwxWW+tqNqJCvZDG+9Pv1JfTa9eODywwnURQdM9fV4zOuAa84aaB2YJ9b9/m2N/7mtYNOBj9E+72KL3V5LfwgHmo/uCc5+T3bpoM8NHGqTNzfXTX9xAr1UrPXg3ZwsZS06weUUh1SplDiMBH67kei5nTKcNVxq4zaQtUtYzi0YznCsn8COLpAK/SOQ== [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ast import literal_eval | |
| ciphertext = int(open("ciphertext.txt", 'rb').read()) | |
| pubkey = literal_eval(open("pubkey.txt", 'rb').read()) | |
| def mat(pubkey, ciphertext, B): | |
| n = len(pubkey) | |
| A = Matrix(ZZ,n+1,n+1) | |
| for i in range(n): | |
| A[i,i] = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <sys/time.h> | |
| using namespace std; | |
| void make_leq(int& a, int& b) { | |
| if (a > b) swap(a,b); | |
| } | |
| void bitonic(vector<int>& xs) { | |
| int n = xs.size(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MonologSlackHandler extends \Monolog\Handler\MailHandler { | |
| protected $hook_url; | |
| protected $channel; | |
| protected $username; | |
| protected $icon; | |
| /** | |
| * @param string $hook_url The URL of your incoming web hook (e.g. | |
| * https://hooks.slack.com/services/$token) | |
| * @param string $channel Slack channel to post in (with leading # sign) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from https://github.com/ctfs/write-ups-2015/tree/master/mma-ctf-2015/crypto/LCG-sign-400 | |
| from Crypto.Util.number import * | |
| from hashlib import sha256 | |
| import random | |
| import sys | |
| import key | |
| p = 267336782497463360204553349940982883027638137556242083062698936408269688347005688891456763746542347101087588816598516438470521580823690287174602955234443428763823316700034360179480125173290116352018408224011457777828019316565914911469044306734393178495267664516045383245055214352730843748251826260401437050527 | |
| q = 133668391248731680102276674970491441513819068778121041531349468204134844173502844445728381873271173550543794408299258219235260790411845143587301477617221714381911658350017180089740062586645058176009204112005728888914009658282957455734522153367196589247633832258022691622527607176365421874125913130200718525263 | |
| g = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def rsolve(coeff, values, rhs=0, nonhom_sol=0): | |
| R.<x> = CC[] | |
| f = 0 | |
| for i, c in enumerate(coeff): | |
| f += c * x**i | |
| h = 0 | |
| n = var('n') | |
| cs = [] | |
| cnt = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| memo = {} | |
| def p(n,k): | |
| if (n,k) in memo: return memo[n,k] | |
| if (n,k) == (0,0): return 1 | |
| if n < k or (n > 0 and k == 0): return 0 | |
| memo[n,k] = p(n-k,k) + p(n-1,k-1) | |
| return memo[n,k] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import socket | |
| import subprocess | |
| import hashlib | |
| p = 195589859419604305972182309315916027436941011486827038011731627454673222943892428912238183097741291556130905026403820602489277325267966860236965344971798765628107804393049178848883490619438682809554522593445569865108465536075671326806730534242861732627383004696136244305728794347161769919436748766859796527723 | |
| g = pow(2, 2*4759647095086827597559114855685975263112106458932414012998147177848303887783492510354911068366203455488902018600593880874117783509946030773587965941, p) | |
| gens = [pow(g,3**(336-i),p) for i in range(336)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // We want to prove that 5618427494400 is the maximum sigma in range 1..10^12 | |
| // | |
| // The following algorithm will explore the entire search space and prune it | |
| // using an upper bound for sigma, while considering the lower bound given by | |
| // our example of sigma(995886571680) = 5618427494400 | |
| // | |
| // We consider only primes up to sqrt(10^12). A single prime p is obviously | |
| // not the solution because the sum of its divisors is | |
| // p + 1 < 10^12 < 5618427494400 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tenpows = [10**i for i in range(1000)] | |
| def cantor(hi): | |
| res = 0 | |
| iters = 0 | |
| while hi > 0: | |
| if iters % 100 == 0: print 'Progress: %d' % hi | |
| iters += 1 | |
| hi_s = str(hi) | |
| memo = {} |