Reign Banner

About:

Since establishment in 2020 - Reign is on its fourth competition. Reign is a cybersecurity competition like no other, as this year’s competition transpires within a 2D dungeon crawler platformer game. You will make your way through vigorous challenges, interact with Wizards, Dragons and other NPCs, decrypt secret messages, and navigate your way throughout a kingdom under fire and into the depths of a lair to fulfill your quest. However, not everything is as it seems, and you must use your wits and cunning to progress through levels of increasing difficulty to ultimately unravel the truth. Participants should expect to be tested on their knowledge of cybersecurity, computer science, mathematics, cryptography, and general critical thinking skills.

Dates:

Summer 2025

Reign Dude

Defcon challenge

from sage.all import *
from flag import flag
from Crypto.Util.number import *
from random import randint, getrandbits

class RNG:
    def __init__(self):
        self.m = getrandbits(64)
        self.a = getrandbits(64) % self.m
        self.b = getrandbits(64) % self.m
        self.c = getrandbits(64) % self.m
        self.s0 = getrandbits(64) % self.m
        self.s1 = getrandbits(64) % self.m

    def __next__(self):
        s0, s1 = self.s0, self.s1
        self.s0 = s1
        self.s1 = (s1 * self.a + s0 * self.b + self.c) % self.m
        return self.s1

nbits = 512

e = 65537
p = getPrime(nbits)
q = getPrime(nbits)
N = p*q
phi = (p-1)*(q-1)
d = pow(e, -1, phi)
m = bytes_to_long(flag)
ct = pow(m, e, N)

rng = RNG()
_p = hex(p)[2:].zfill(nbits//4)
for _ in range(4):
    rand_index = next(rng) % ((nbits // 4) - 4)
    _p = _p[:rand_index] + '?'*4 + _p[rand_index+4:]
assert(len(_p)*4 == nbits)

p_hint = ''.join(_p.split('?'))

rand_iters = randint(0, 256)
rng_output = []
for _ in range(rand_iters):
    next(rng)
for _ in range(10):
    rng_output.append(next(rng))

print(f'N = {hex(N)}')
print(f'c = {hex(ct)}')
print(f'p_hint = {p_hint}')
print(f'rng_output = {rng_output}')

'''
N = 0xa4e5852ffac830050f176a269f08e20608a8fd909b125401120b4cdbd7167b557e859e6f9980ef5a8c93e87fe278d4031460f53e9067aa40251a9f5b6fcd01fdf79c4c3b0759bb81997ccbf262d07beb84d912e6ff6a7e02601a7af97346750e40ae471dc5104a30f2796137f8173f9ba8d1015dadb29c660884ea57fed29191
c = 0x43206161d32ee0f7cd838d1a75b504f9da0a56c67889821ce42490b83967d24ab92a9be0428b9ae3a63ca80569271d09849013abed9450b332a0e8e4481999b1e9e97ff3bceab362614784fdbb25d03c9c7775bd3ea4ad8b64a3a3b64306824fbac757ac3c99e021ae9039249544985f466b2727325521fbb92d2db78087fb04
p_hint = afe835c8c1e4e69948fa10af45b296d30787b87ab1637f1d2b015ee7a1360a7e59ceaedfb7f86c8ea2ab017fbcab6fe67dace7ba35266e39
rng_output = [577525790031919867, 162459642053597831, 509984639222207493, 564465008880691532, 602747696202400067, 275373724919406895, 597324098800445880, 513236050832774605, 473528696813180272, 125671836209640383]
'''
The answer will be wrapped in "Reign{ }" format. If you complete the challenge, DM @suvoni on Discord for confirmation. Author: Suvoni Challenge Name: Solitude Challenge Description: Then stirs the feeling infinite, so felt In solitude, where we are least alone. - George Gordon Byron https://github.com/suvoni https://x.com/suvoni_ https://l3ak.team/