good_challenges_2021
#zh3ro_CTF_2021 #good_challenges_2021 import os from numpy import random from Crypto.Cipher import AES from Crypto.Util.Padding import pad from secret import flag def rand_32(): return int.from_bytes(os.urandom(4),'big') flag = pad(flag,16…
#aeroctf2021 #good_challenges_2021 #!/usr/bin/env sage p = 2 F = GF(p) P.<x> = PolynomialRing(F) class Cipher: def __init__(self, size, params): self.size = size self.params = params def sequence(self, key): while True: key = key * self.param</x>…
#acsc2021 #good_challenges_2021 #!/usr/bin/env python3 import os import random import string with open('flag.txt', 'rb') as f: FLAG = f.read().strip() assert FLAG.startswith(b'ACSC{') assert FLAG.endswith(b'}') SECRET = FLAG[5:-1] assert l…
#backdoorctf2021 #good_challenges_2021 from Crypto.Util.number import * import json from hashlib import sha256 def xor(a, b): return bytes([i^^j for (i, j) in zip(a, b)]) flag = open('flag.txt', 'rb').read() p = 130804003790372516314205890…
#zer0ptsCTF2021 #good_challenges_2021 from Crypto.Util.number import * from flag import flag assert len(flag) == 40 p = 74894047922780452080480621188147614680859459381887703650502711169525598419741 a1 = 224575631270940326485290529052700833…
#joseph #downunderctf2021 #good_challenges_2021 def encrypt(pubkey, msg): gens = pubkey[0].parent().gens() n = len(gens) B = ''.join(f'{c:08b}' for c in msg) B = list(map(int, B)) assert len(B) <= n B += [0] * (n - len(B)) subs = { x: b fo…
#diceCTF_2021 #good_challenges_2021 Two agents, Blex and Kane, have simultaneously known very secret message and transmitted it to Center. You know following: 1) They used RSA with this public key 2) They sent exactly the same messages exc…
#bsidesnoidactf #good_challenges_2021 from decimal import Decimal, getcontext from Crypto.Util.number import bytes_to_long, getRandomNBitInteger def is_valid_privkey(n): if n < 0: return False c = n * 4 // 3 d = c.bit_length() a = d >> 1 i…
#good_challenges_2021 #PlaidCTF2021 import flag import hashcash import secrets from Crypto.Cipher import AES def gf128(a, b): a = int.from_bytes(a, byteorder="big") b = int.from_bytes(b, byteorder="big") R = 128 P = sum(1 << x for x in [R,…
#aeroctf2021 #good_challenges_2021 #!/usr/bin/env python3.8 from gmpy import next_prime from random import getrandbits def bytes_to_long(data): return int.from_bytes(data, 'big') class Wardrobe: @staticmethod def create_boggarts(fear, dang…
#OMH2021CTF #good_challenges_2021 from Crypto.Util.number import long_to_bytes from Crypto.Cipher import AES load('secret.sage') M = x^127 + x^126 + x^125 + x^124 + x^122 + x^120 + x^118 + x^117 + x^115 + x^108 + x^107 + x^104 + x^103 + x^…
#rarctf2021 #good_challenges_2021 ''' Base-3 AES Just use SAGE lmao ''' T_SIZE = 3 # Fixed trits in a tryte W_SIZE = 3 # Fixed trytes in a word (determines size of matrix) POLY = (2, 0, 1, 1) # Len = T_SIZE + 1 POLY2 = ((2, 0, 1), (1, 2, 0…
#m0lecon2021 #good_challenges_2021 https://keltecc.github.io/ctf/writeup/2021/05/15/m0lecon-ctf-2021-teaser-giant-log.html import random from secret import flag, fast_exp import signal p = 0x83f39daf527c6cf6360999dc47c4f0944ca1a67858a11bd9…
#diceCTF_2021 #good_challenges_2021 from Crypto.Random.random import randrange from Crypto.Util.number import getPrime, GCD r = 17 def keygen(): while True: p = getPrime(1024) a, b = divmod(p-1, r) if b == 0 and GCD(r, a) == 1: break while…
#downunderctf2021 #joseph #good_challenges_2021 from Crypto.Util.number import getPrime, bytes_to_long flag = open('flag.txt', 'rb').read().strip() p, q = getPrime(1337), getPrime(1337) n = p*q K.<z> = NumberField((x-p)^2 + q^2) hint1 = p^2 +</z>…