rarctf2021

RaRCTF 2021 | babycrypt

#rarctf2021 from Crypto.Util.number import getPrime, bytes_to_long flag = bytes_to_long(open("/challenge/flag.txt", "rb").read()) def genkey(): e = 0x10001 p, q = getPrime(256), getPrime(256) if p <= q: p, q = q, p n = p * q pubkey = (e, n…

RaRCTF 2021 | mini-a3s

#rarctf2021 ''' 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), (0, 2, 1), (2, 0, 1…

RaR CTF 2021 | psychecc

#rarctf2021 from collections import namedtuple import random def moddiv(x,y,p): return (x * pow(y, -1, p)) %p Point = namedtuple("Point","x y") class EllipticCurve: INF = Point(0,0) def __init__(self, a, b, p): self.a = a self.b = b self.p…

RaRCTF 2021 | randompad

#rarctf2021 from random import getrandbits from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long def keygen(): # normal rsa key generation primes = [] e = 3 for _ in range(2): while True: p = getPrime(1024) if (p - 1) % 3: …

RaR CTF 2021 | sRSA

#rarctf2021 from Crypto.Util.number import * p = getPrime(256) q = getPrime(256) n = p * q e = 0x69420 flag = bytes_to_long(open("flag.txt", "rb").read()) print("n =",n) print("e =", e) print("ct =",(flag * e) % n) RSAじゃないし n = 549627…

RaR CTF 2021 | rotoRSA

#rarctf2021 from sympy import poly, symbols from collections import deque import Crypto.Random.random as random from Crypto.Util.number import getPrime, bytes_to_long, long_to_bytes import sys def build_poly(coeffs): x = symbols('x') retur…

RaRCTF 2021 | unrandompad

#rarctf2021 from random import getrandbits from Crypto.Util.number import getPrime, long_to_bytes, bytes_to_long def keygen(): # normal rsa key generation primes = [] e = 3 for _ in range(2): while True: p = getPrime(1024) if (p - 1) % 3: …

RaRCTF 2021 | snore

#rarctf2021 from Crypto.Util.number import long_to_bytes, bytes_to_long, isPrime from Crypto.Util.Padding import pad from Crypto.Cipher import AES from hashlib import sha224 from random import randrange import os p = 1489829114012647345006…

RaRCTF 2021 | a3s

#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…

RaR CTF 2021 | Shamir's Stingy Sharig

#rarctf2021 import random import sys from Crypto.Util.number import long_to_bytes def bxor(ba1,ba2): return bytes([_a ^ _b for _a, _b in zip(ba1, ba2)]) BITS = 128 SHARES = 30 poly = [random.getrandbits(BITS) for _ in range(SHARES)] flag =…