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
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
from sock import Sock | |
f = Sock("52.197.160.186 31337") | |
def read_map(): | |
res = [] | |
print " ", "".join("%2d" % i for i in xrange(19)) |
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
''' | |
http://www.chesworkshop.org/ches2011/presentations/Session%204/CHES2011_Session4_3.pdf | |
First part - collecting CRT values. | |
''' | |
import subprocess | |
from sock import Sock | |
from libnum import gcd, solve_crt | |
def getHashes(p): | |
return subprocess.check_output(["./sha1", p]).split()[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
from binascii import crc32 | |
def lcg_step(): | |
global lcg | |
lcg = (0x5851F42D4C957F2D * lcg + 0x14057B7EF767814F) % 2**64 | |
return lcg | |
def extract(val): | |
res = 32 + val - 95 * (( | |
((val - (0x58ED2308158ED231 * val >> 64)) >> 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
#-*- coding:utf-8 -*- | |
""" | |
Hastad's broadcast attack (CRT + root in integers) | |
""" | |
import os, re | |
from collections import defaultdict | |
from libnum import * |
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 sage.all import * | |
import re | |
active_bits = [ | |
0, 3, 4, 7, 8, 9, 10, 11, 14, 20, 21, 24, 25, 26, | |
35, 40, 41, 43, 45, 46, 47, | |
] | |
code = """ |
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 sage.all import * | |
from itertools import product | |
def frombin(v): | |
return int("".join(map(str, v)), 2 ) | |
def l33tize(s, eight=False): | |
ms = GL(8 if eight else 6, GF(2)) | |
while 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
''' | |
Common-prime (in group order!) RSA with low private exponent. | |
p = 2ga + 1 | |
q = 2gb + 1 | |
N = p * q | |
phi(N) = 2gab | |
''' | |
from sage.all import * |
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
#-*- coding:utf-8 -*- | |
''' | |
DEF CON 2017 Quals - Godzilla (Reverse) | |
Timing attack on RSA decryption. | |
Based on http://www.cs.jhu.edu/~fabian/courses/CS600.624/Timing-full.pdf | |
Another solutions: | |
https://gist.github.com/nneonneo/367240ae2d8e705bb9173a49a7c8b0cd by b2xiao | |
https://gist.github.com/Riatre/caac24840b176cf843b3f66ad9a5eeaf by riatre |
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
/** | |
* Print a Flag. | |
* @author Daniel Bleichenbacher | |
*/ | |
package blt; | |
import java.math.BigInteger; | |
import java.security.MessageDigest; | |
import java.security.SecureRandom; | |
import java.security.GeneralSecurityException; |
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
''' | |
CRC is affine. | |
CRC(x) = L(x) + C, where L is linear. | |
We want CRC(x) = L(x) + C = x. | |
Write as L(x)+x = C. | |
Solve matrix equation. | |
''' | |
from sage.all import * |