This file contains 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 __future__ import division | |
import hashlib | |
import requests | |
from datetime import datetime, timedelta | |
api_url = 'http://rfile.2017.teamrois.cn/api/download/{}/{}' | |
def totimestamp(dt, epoch=datetime(1970,1,1)): | |
td = dt - epoch | |
return (td.microseconds + (td.seconds + td.days * 86400) * 10**6) / 10**6 |
This file contains 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 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 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 itertools | |
# display matrix picture with 0 and X | |
# references: https://github.com/mimoo/RSA-and-LLL-attacks/blob/master/boneh_durfee.sage | |
def matrix_overview(BB, bound): | |
for ii in range(BB.dimensions()[0]): | |
a = ('%02d ' % ii) | |
for jj in range(BB.dimensions()[1]): | |
a += ' ' if BB[ii,jj] == 0 else 'X' |
This file contains 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 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 <cassert> | |
#include <NTL/mat_GF2.h> | |
#include <NTL/GF2.h> | |
using NTL::GF2; | |
using NTL::mat_GF2; | |
using NTL::conv; | |
int g(GF2 x1, GF2 z1, GF2 x2, GF2 z2) { |
- 問題文: https://community.topcoder.com/longcontest/?module=ViewProblemStatement&rd=16833&pm=14534
- 順位表: https://community.topcoder.com/longcontest/stats/?module=ViewOverview&rd=16833
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>いま開催中のマラソンマッチ、c3.4xlarge(16コア)でストレージIOもありという環境での高速化コンテストだ。これは高速化を生業にしている某社のみなさまの出番では https://t.co/yIruowYFAI
— 今年は夏バテにならない (@tomerun) 2017年2月3日
ということで参加してました。
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
This file contains 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) + |