2023-12-03から1日間の記事一覧

watevr ctf 2019 | ECC-RSA

#EllipticCurve from fastecdsa.curve import P521 as Curve from fastecdsa.point import Point from Crypto.Util.number import bytes_to_long, isPrime from os import urandom from random import getrandbits def gen_rsa_primes(G): urand = bytes_to_…

tetctf 2021

tetctf 2020の問題ほどは面白くなかった印象。同じようなジャンルの問題が偏ると競技者としてはつまらないよね 48時間を3問で持たせるのすごいな

redpwn CTF 2021 | scissor

#redpwnctf2021 #uninterested_challenge_list crypto/scissor BrownieInMotion 1005 solves / 102 points I was given this string and told something about scissors. egddagzp_ftue_rxms_iuft_rxms_radymf import random key = random.randint(0, 25) al…

pbctf 2021 | Alkaloid Stream

#pbctf_2021 #rbtree #!/usr/bin/env python3 import random from flag import flag def keygen(ln): # Generate a linearly independent key arr = [ 1 << i for i in range(ln) ] for i in range(ln): for j in range(i): if random.getrandbits(1): arr[j…

corCTF 2021 | leave it to chance

#corctf2021

X-MAS CTF | Hashed Presents v1

from hash import secureHash import SocketServer import string import random from text import * import os from hashlib import sha256 PORT = 2000 ROUNDS = 10 TIMEOUT = 120 sigma = string.ascii_letters + string.digits + "!@#$%^&*()-_=+[{]}<>.…

UMASS CTF 2022 | hatmash

#UMASS_CTF_2022 #!/usr/bin/env python3 # # Polymero # # Imports import os # Local imports with open('flag.txt','rb') as f: FLAG = f.read() f.close() def bytes_to_mat(x): assert len(x) == 32 bits = list('{:0256b}'.format(int.from_bytes(x,'b…

TetCTF 2022 | fault

#tetctf2022 from secrets import randbits from Crypto.Util.number import getPrime # pycryptodome NBITS = 1024 D_NBITS = 128 # small `d` makes decryption faster class Cipher: def __init__(self): p = getPrime(NBITS // 2) q = getPrime(NBITS //…

TSG CTF 2020 | Sweet Like Apple Pie

crt

#CRT

TSG CTF 2020 | Rubikrypto

#RubikCube

TG:HACK 2019 |Josefssons Final Exam

#TG:HACK2019 Mr. Josefsson wants to test you one last time to see if you are ready for the harder tasks. Can you solve this? good_luck ! 00100011 00100010 00000100 00000010 00001000 00101010 00010111 00001011 00000001 01010101 01010110 000…

Securinets CTF Quals 2019 | Maze

#SecurinetsCTFQuals2019 https://ctftime.org/task/7862 https://furutsuki.hatenablog.com/entry/2019/03/25/214238#Crypto-962pts-50-solvesMAZE

SECCON 2021 | pppp

#kurenaif #seccon2021 from Crypto.Util.number import * from flag import flag p = getStrongPrime(512) q = getStrongPrime(512) n = p*q mid = len(flag) // 2 e = 65537 m1 = int.from_bytes(flag[:mid], byteorder='big') m2 = int.from_bytes(flag[m…

SECCON 2021 | CCC

#xornet #seccon2021 from Crypto.Util.number import bytes_to_long, getPrime, getRandomInteger, isPrime from secret import flag def create_prime(p_bit_len, add_bit_len, a): p = getPrime(p_bit_len) p_bit_len2 = 2*p_bit_len // 3 + add_bit_len …

RTACTF | Sexy RSA

#rtactf from Crypto.Util.number import getPrime, isPrime import os def getSexyPrime(n=512): # Sexy prime: https://en.wikipedia.org/wiki/Sexy_prime while True: p = getPrime(n) if isPrime(p+6): return p, p+6 if __name__ == '__main__': # Plai…

RLWE Sginature

Ring LWE

PragyanCTF 2019|Help Rabin

https://ctftime.org/task/7777 #pragyanctf #RabinCryptosystem #フェルマー法 Rabin has received a text from someone special, but it's all in ciphertext and he is unable to make head or tail of it. He requested her for a little hint, and she …

PragyanCTF 2019|Add Them Sneaky Polynomials

https://ctftime.org/task/7821 #pragyanctf Rahul, the geek boy of his class, doesn't like doing things the conventional way. He's just learned polynomials in class, and wants to prove a point to his friend Sandhya. But Sandhya is sitting in…

InCTF 2020 | DLPoly

#inctf2020 sage: p 35201 sage: len(flag) 14 sage: X = int.from_bytes( flag.strip(b'inctf{').strip(b'}') , 'big') sage: n 1629*x^256 + 25086*x^255 + 32366*x^254 + 21665*x^253 + 24571*x^252 + 20588*x^251 + 17474*x^250 + 30654*x^249 + 31322*x…

Imaginary CTF 2023 | Tan

print(tan(int.from_bytes(open("flag.txt", "rb").read().strip(), "big")).n(1024)) # -0.757848646514436165305674088364798107415772156823526394781277032859370615544627343198300308302394419345163450113384406222231838091222846932198471177164033…

Imaginary CTF 2021 | Rock Solid Algorithm

#imaginaryctf2021 n = 1871866865483941810106035041489767872458177408174210228790876521269086223189954740558299715702009349950617763239543057254260001925842494780359139592647224634741398653143717780175432460620024371083660969445388889466865…

HackTM CTF 2020 Finals | rSAGA 1

#HackTM_CTF_2020_Finals RSA from Crypto.Util.number import getStrongPrime, inverse, bytes_to_long from flag import flag p = getStrongPrime(1024) q = getStrongPrime(1024) e = 65537 N = p * q phiN = (p - 1) * (q - 1) d = inverse(e, phiN) dp …

HSCTF 8 | Regulus Satrapa

#hsctf8 from Crypto.Util.number import * import binascii flag = open('flag.txt','rb').read() p = getPrime(1024) q = getPrime(1024) n = p*q e = 2**16+1 pt = int(binascii.hexlify(flag).decode(),16) print(p>>512) print(q%(2**512)) print(n, e)…

Fword CTF 2020 | Mini Cooper

#!/usr/bin/python from Crypto.Util.number import * from random import * from gmpy2 import * from fractions import * from binascii import hexlify from secret import flag #Setting up params a = randrange(2**10,2**11) b = randrange(2**12,2**1…

Fireshell CTF 2019|Alphabet

#FireshellCTF2019 https://ctftime.org/task/7486 問題文 If you know your keyboard, you know the flag 一緒に渡されるファイル https://gist.githubusercontent.com/theoldmoon0602/fcf5368212f584262ae730bb1b34cbc6/raw/f3fb787e62053a78178da51f8a2ad…

DiceCTF 2022 | baby-rsa

#diceCTF2022 from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes def getAnnoyingPrime(nbits, e): while True: p = getPrime(nbits) if (p-1) % e**2 == 0: return p nbits = 128 e = 17 p = getAnnoyingPrime(nbits, e) q = getAnno…

DES

鍵長: 56bit(64bitの鍵を与えるが、その後8bit捨てられる) ブロック長: 64bit 16ラウンドのFeistel構造を用いたブロック暗号 DESは次のような疑似コードで表される def feistel(m, k): m = expand(m) # 32bit -> 48bit m = m ^ k return [sboxes[i](m[i*…

Crypto CTF 2021 | polish

#cryptoctf2021 m = bytes_to_long(flag) e = 65537 n = p * q = 4024625003400831261259737276316748212140359464095903327962527444430093199954898873916032867176701877865239488518540105913088786921133059927211384908878012962458167444131493813926…

Crypto CTF 2021 | My Sieve

#cryptoctf2021

CrewCTF 2022 | The HUGE e

#CrewCTF_2022 from Crypto.Util.number import getPrime, bytes_to_long, inverse, isPrime from secret import flag m = bytes_to_long(flag) def getSpecialPrime(): a = 2 for i in range(40): a*=getPrime(20) while True: b = getPrime(20) if isPrime…