A "rogue developer" encrypted a classified record with their own stream
cipher before leaving. You get encrypted_3.txt (the ciphertext) and
generator_5.py (the whole tool, source included). Telemetry pins the
run to October 2026.
1def encrypt(data: bytes, seed: int) -> bytes:
2 random.seed(seed)
3 keystream = bytes(random.randint(0, 255) for _ in range(len(data)))
4 return bytes(d ^ k for d, k in zip(data, keystream))
5
6# Example usage when developer executed the tool:
7# seed = int(time.time()) # Redacted: executed during October 2026
Insight
The whole "cipher" is Python's random module reseeded with a Unix
timestamp, used as a one-time XOR keystream. random.seed(int) is fully
deterministic, and a month is only 2,678,400 seconds - a brute-forceable
seed space once you know the range to search. "Redacted" doesn't mean
unknown here, just narrowed to one month.
Brute-forcing the timestamp
1import datetime, random
2
3UTC = datetime.timezone.utc
4START = int(datetime.datetime(2026, 10, 1, tzinfo=UTC).timestamp())
5END = int(datetime.datetime(2026, 11, 1, tzinfo=UTC).timestamp())
6
7def decrypt(seed, n):
8 random.seed(seed)
9 return bytes(CT[i] ^ random.randint(0, 255) for i in range(n))
10
11for seed in range(START, END):
12 if all(32 <= b <= 126 for b in decrypt(seed, 8)): # cheap printable-ASCII prune
13 pt = decrypt(seed, len(CT))
14 if b"L3m0n{" in pt:
15 print(seed, pt)
16 break
Pitfall
The obvious filter is "the whole decrypted file should be printable
ASCII" - and that's wrong, which costs the correct seed if you apply it
over the whole buffer. The real report contains a UTF-8 em dash
(0xE2 0x80 0x94) at offset 11, which isn't ASCII-printable at all. Prune
on just a short prefix (8 bytes was enough here) and confirm with a plain
L3m0n{ substring search over the full decrypt, rather than demanding
the entire file pass a printable check.
2.7 million seeds is small enough to brute force directly in plain Python in well under a minute; the correct seed falls out, the timestamp decodes to a specific second in October 2026, and the decrypted record contains:
L3m0n{7f81a007e85aee91ded410d1cef3cfcf}
Note
The "security" here was obscurity, not cryptography: the seed looked secret because it was "redacted," but a Unix timestamp constrained to a known month has only a few million possibilities - nowhere near enough keyspace for a real stream cipher.