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 sock import Sock | |
from string import printable | |
so = Sock('crypto.2021.chall.actf.co:21112') | |
len_flag=25 | |
def recv(x): | |
so.read_until(b"give input: ") | |
so.send_line(x) | |
res = so.read_line().strip() | |
return res |
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 Crypto.Cipher import AES | |
from Crypto.Util.Padding import pad | |
import os | |
key = os.urandom(32) | |
flag = open("flag","rb").read() | |
while 1: | |
try: | |
i = bytes.fromhex(input("give input: ")) |
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 sock import Sock | |
from gmpy2 import * | |
DIGITS=8 | |
def getNum(seed): | |
seed = str(seed**2).rjust(DIGITS*2, "0")[DIGITS//2:DIGITS +DIGITS//2] | |
return int(seed) | |
def get_random_number(x): | |
arr=divisors(x) | |
for i in arr: |
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
#!/usr/bin/python | |
import binascii | |
from random import choice | |
class Cipher: | |
BLOCK_SIZE = 16 | |
ROUNDS = 3 | |
def __init__(self, key): | |
assert(len(key) == self.BLOCK_SIZE*self.ROUNDS) | |
self.key = key |
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
import time | |
import random | |
import os | |
class Generator(): | |
DIGITS = 8 | |
def __init__(self, seed): | |
self.seed = seed | |
assert(len(str(self.seed)) == self.DIGITS) |
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
import os | |
import zlib | |
def keystream(key): | |
index = 0 | |
while 1: | |
index+=1 | |
if index >= len(key): | |
key += zlib.crc32(key).to_bytes(4,'big') | |
yield key[index] | |
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
çUÿ+Oî/ìV©²ãxPÈõŸÓJè öY±ó6HœdbG©ïmÎ9¬/#Sªì×Ò+ýè¹äbÇ}æHОóÝ3@Ž¹šævŠ>ÀM9Ï4Âá)2åÀ£cûâjäåÍQÙý+5çqW|=ýÅ E˺EØr~4Ön¥}è |
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
import os | |
import zlib | |
def keystream(): | |
key = os.urandom(2) | |
index = 0 | |
while 1: | |
index+=1 | |
if index >= len(key): | |
key += zlib.crc32(key).to_bytes(4,'big') | |
yield key[index] |
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 Crypto.Util.number import * | |
import owiener | |
n=14750066592102758338439084633102741562223591219203189630943672052966621000303456154519803347515025343887382895947775102026034724963378796748540962761394976640342952864739817208825060998189863895968377311649727387838842768794907298646858817890355227417112558852941256395099287929105321231423843497683829478037738006465714535962975416749856785131866597896785844920331956408044840947794833607105618537636218805733376160227327430999385381100775206216452873601027657796973537738599486407175485512639216962928342599015083119118427698674651617214613899357676204734972902992520821894997178904380464872430366181367264392613853 | |
e=156533686705008441817564825595178738521044742605350994060477371492053818662659954420565093029050748810108440613353495282487057420665700177249920005424286943357699708377168129276788355874103504870914736141037458349709378905379660837934925153417371259880961076882739996089263321389129428402820719921437673882146124624610406275206675875392339429920291718 |
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
n: 14750066592102758338439084633102741562223591219203189630943672052966621000303456154519803347515025343887382895947775102026034724963378796748540962761394976640342952864739817208825060998189863895968377311649727387838842768794907298646858817890355227417112558852941256395099287929105321231423843497683829478037738006465714535962975416749856785131866597896785844920331956408044840947794833607105618537636218805733376160227327430999385381100775206216452873601027657796973537738599486407175485512639216962928342599015083119118427698674651617214613899357676204734972902992520821894997178904380464872430366181367264392613853 | |
e: 1565336867050084418175648255951787385210447426053509940604773714920538186626599544205650930290507488101084406133534952824870574206657001772499200054242869433576997083771681292767883558741035048709147361410374583497093789053796608379349251534173712598809610768827399960892633213891294284028207199214376738821461246246104062752066758753923394299202917181866781416802075330591787701014530384229203479804 |