shamir's_secret_sharing
#HITCON_CTF_2022 from random import SystemRandom from Crypto.Cipher import AES from hashlib import sha256 from secret import flag rand = SystemRandom() def polyeval(poly, x): return sum([a * x**i for i, a in enumerate(poly)]) DEGREE = 128 …
https://ctftime.org/task/7823 #pragyanctf It's a new age Order of the Phoenix. The current members are: Harry Hermione Ron George Charlie Bill Ginny Fleur Luna Neville Each of them has a secret QR code associated with him/her which is give…
#!/usr/bin/sage from sage.all import * from Crypto.Util.number import getStrongPrime, bytes_to_long from secret import flag class PRNG256(object): def __init__(self, seed): self.mask = (1 << 256) - 1 self.seed = seed & self.mask def _pick(…
#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 =…
#angstromctf2021 import random import secrets from decimal import Decimal, getcontext from Crypto.Cipher import AES BOUND = 2 ** 128 MULT = 10 ** 10 getcontext().prec = 50 def nums(a): b = Decimal(random.randint(-a * MULT, a * MULT)) / MUL…