$ cat writeup.md…
$ cat writeup.md…
broncoctf2026
Task: a homemade polynomial 'public-key' scheme where the public polynomial is a literal factor of every ciphertext polynomial and message bytes are appended as linear factors (x - m). Solution: exact monic polynomial division of ciphertext by public key yields the degree-4 message polynomial, then bounded integer root search (0..255) plus the packed order integer recovers the plaintext bytes.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
I've finally made the perfect public-key encryption algorithm! Its security is rivaled only by it's message space efficiency. In fact, I'm so confident that I'll send you the flag along with my public key, and there's nothing you can do to read it.
We are given pscheme.py (the encryption scheme) and enc.txt (the public key and the encrypted flag). The goal is to recover the flag from the public key and ciphertext alone.
The scheme is a homemade polynomial-based "public-key" cipher:
keygen(root_bits=8, key_degree=64) picks 64 random secret integer roots in [1, 255] and builds the public polynomial as the monic product of linear factors ∏ (x - root). So the public key is a degree-64 monic polynomial whose roots are the private key.encrypt(public, message) takes a message of 4 integers (the ord() values of 4 plaintext chars, zero-padded). It multiplies the public polynomial by four more linear factors (x - m_i), producing a degree-68 monic polynomial. It also returns an order integer that packs the permutation needed to restore the original byte positions after the message was sorted — 2 bits per index, order = sum(idx << (2*i)).encrypt_string processes the flag in 4-char blocks. For each block it emits the ciphertext polynomial coefficients (space-separated, via to_distrib_form, which drops the leading monic 1) followed by the packed order integer. Blocks are joined with /.The whole scheme collapses because of the multiplicative structure:
...
$ grep --similar