def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 6:
return False
a = ord(x[0]) ^ ord(x[1])
b = ord(x[2]) | ord(x[3])
c = ord(x[4]) & ord(x[5])
d = sum(ord(ch) for ch in x)
return a == 0 and b == 0x7F and c == 0x60 and d == 513
def mystery(x):
MASK64 = (1 << 64) - 1
MASK32 = (1 << 32) - 1
def u32(v): return v & MASK32
def u64(v): return v & MASK64
def rotl32(v, r):
v &= MASK32
r &= 31
return u32((v << r) | (v >> (32 - r)))
def _hidden_plain_u64():
# 8 bytes, but masked with a position-dependent XOR to avoid being obvious.
masked = [0x0F, 0x83, 0x49, 0xB3, 0x0A, 0xA3, 0x8A, 0x61]
b = bytearray(8)
for i, m in enumerate(masked):
b[i] = m ^ ((i * 37 + 101) & 0xFF)
return int.from_bytes(b, "big") & MASK64
def F(r, k):
# Nonlinear-ish 32-bit round function.
r = u32(r + k)
r ^= rotl32(r, 7)
r = u32(r * 0x7FEB352D)
r ^= (r >> 16)
r = u32(r + 0x846CA68B)
r ^= rotl32(r, 11)
return u32(r)
def perm64(v):
# 64-bit Feistel permutation (invertible).
L = (v >> 32) & MASK32
R = v & MASK32
keys = [
0x243F6A88, 0x85A308D3, 0x13198A2E,
0x03707344, 0xA4093822, 0x299F31D0,
]
for k in keys:
L, R = R, u32(L ^ F(R, k))
return u64((L << 32) | R)
# Parse input
if isinstance(x, bool):
return False
if isinstance(x, int):
u = x
elif isinstance(x, str):
s = x.strip().replace("_", "")
try:
u = int(s, 0) # allows "123", "0x...", etc.
except Exception:
return False
else:
return False
if not (0 <= u < (1 << 64)):
return False
# The check: your input must land on a hidden target under a 64-bit permutation.
target = perm64(_hidden_plain_u64())
return perm64(u) == target
def mystery(x):
if isinstance(x, bool):
return False
if isinstance(x, int):
n = x
elif isinstance(x, str):
s = x.strip()
try:
n = int(s)
except ValueError:
return False
else:
return False
if not (1000000000 < n < 2000000000):
return False
t = n * n - 1
if t % 61 != 0:
return False
y2 = t // 61
y = int(y2 ** 0.5)
return y * y == y2
def mystery(x):
MASK64 = (1 << 64) - 1
MASK32 = (1 << 32) - 1
def u32(v): return v & MASK32
def u64(v): return v & MASK64
def rotl32(v, r):
v = u32(v)
r &= 31
return u32((v << r) | (v >> (32 - r)))
def rotr32(v, r):
v = u32(v)
r &= 31
return u32((v >> r) | (v << (32 - r)))
def mix64(z):
# SplitMix64-style reversible mixer (over 64-bit words).
z = u64(z)
z ^= (z >> 30)
z = u64(z * 0xBF58476D1CE4E5B9)
z ^= (z >> 27)
z = u64(z * 0x94D049BB133111EB)
z ^= (z >> 31)
return u64(z)
def _round_keys():
# Key schedule via a small LCG to avoid an obvious literal key list.
s = 0xC001D00D
ks = []
for _ in range(9):
s = u32(s * 1664525 + 1013904223)
ks.append(u32(s ^ (s >> 16)))
return ks
KS = _round_keys()
def F(r, k):
r = u32(r + k)
r ^= rotl32(r, 5) ^ rotr32(r, 7)
r = u32(r * 0x9E3779B1)
r ^= (r >> 16)
r = u32(r + 0x7F4A7C15)
r ^= rotl32(r, 13)
return u32(r)
def perm64(v):
# 64-bit Feistel permutation (bijective).
v = u64(v)
L = u32(v >> 32)
R = u32(v)
for k in KS:
L, R = R, u32(L ^ F(R, k))
return u64((L << 32) | R)
def _secret_u64():
# Secret 8 bytes, stored scrambled + masked.
scr = [5, 2, 7, 0, 4, 1, 6, 3]
ms = [0xFC, 0x8A, 0x42, 0x67, 0x11, 0x4D, 0xDE, 0x04]
masked = [0] * 8
for i, j in enumerate(scr):
masked[j] = ms[i]
b = bytearray(8)
for i, mv in enumerate(masked):
m = ((i * 113 + 57) ^ (0xC3 - i * 11)) & 0xFF
b[i] = mv ^ m
return int.from_bytes(b, "big")
# Parse input
if isinstance(x, bool):
return False
if isinstance(x, int):
u = x
elif isinstance(x, str):
s = x.strip().replace("_", "")
try:
u = int(s, 0) # accepts "123", "0x...", etc.
except Exception:
return False
else:
return False
if not (0 <= u < (1 << 64)):
return False
# Bijection composition => unique solution in 0..2^64-1.
return mix64(perm64(u)) == mix64(perm64(_secret_u64()))
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 7:
return False
a = ord(x[0]) + ord(x[1]) + ord(x[2])
b = ord(x[3]) * ord(x[4])
c = ord(x[5]) ^ ord(x[6])
d = sum(ord(ch) for ch in x)
return a == 300 and b == 10800 and c == 0 and d == 700
def mystery(x):
MASK64 = (1 << 64) - 1
MASK32 = (1 << 32) - 1
def u32(v): return v & MASK32
def u64(v): return v & MASK64
def rotl32(v, r):
v = u32(v)
r &= 31
return u32((v << r) | (v >> (32 - r)))
def mix64(z):
# Bijective 64-bit mixer (SplitMix64-style).
z = u64(z)
z ^= (z >> 30)
z = u64(z * 0xBF58476D1CE4E5B9)
z ^= (z >> 27)
z = u64(z * 0x94D049BB133111EB)
z ^= (z >> 31)
return u64(z)
def xorshift_star(v):
# Marsaglia xorshift64* (also bijective because steps are invertible; mul by odd is invertible mod 2^64).
v = u64(v)
v ^= (v >> 12)
v ^= u64(v << 25)
v ^= (v >> 27)
return u64(v * 0x2545F4914F6CDD1D)
def round_keys():
# Key schedule derived from an LCG + bit mangling (no obvious literal key table).
s = 0x9E3779B9
ks = []
for i in range(10):
s = u32(s * 1103515245 + 12345 + i * 97)
k = u32(s ^ rotl32(s, 7) ^ (s >> 9))
ks.append(k)
return ks
KS = round_keys()
def F(r, k):
# 32-bit round function (not meant to be cryptographic, just non-linear-ish).
r = u32(r + k)
r ^= rotl32(r, 5) ^ rotl32(r, 17)
r = u32(r * 0x7FEB352D)
r ^= (r >> 16)
r = u32(r + 0x846CA68B)
r ^= rotl32(r, 11)
return u32(r)
def feistel64(v):
v = u64(v)
L = u32(v >> 32)
R = u32(v)
for k in KS:
L, R = R, u32(L ^ F(R, k))
return u64((L << 32) | R)
def _secret_u64():
# Reconstruct 8 secret bytes via a permutation + per-position mask.
scr = [3, 1, 6, 0, 7, 2, 5, 4]
masked = [0x15, 0x6B, 0xF6, 0xFE, 0xA3, 0x79, 0x1E, 0x17]
b = bytearray(8)
for i in range(8):
m = ((i * 0x5D + 0xA7) ^ ((i + 1) * 0x33)) & 0xFF
b[i] = masked[scr[i]] ^ m
return int.from_bytes(b, "big") & MASK64
# Parse input as an integer (string accepted in base 0 form).
if isinstance(x, bool):
return False
if isinstance(x, int):
u = x
elif isinstance(x, str):
s = x.strip().replace("_", "")
try:
u = int(s, 0)
except Exception:
return False
else:
return False
if not (0 <= u < (1 << 64)):
return False
def transform(v):
v = u64(v)
v ^= 0xD6E8FEB86659FD93
v = u64(v * 0xA24BAED4963EE407) # odd => invertible mod 2^64
v = xorshift_star(v)
v = feistel64(v)
v = mix64(v)
v ^= 0x9DDFEA08EB382D69
return u64(v)
return transform(u) == transform(_secret_u64())
def mystery(x):
if not isinstance(x, str):
return False
if len(x) != 8:
return False
a = [ord(c) for c in x]
if sum(a) != 648:
return False
xor_all = 0
for v in a:
xor_all ^= v
if xor_all != 104:
return False
if (a[0] * a[1] * a[2]) % 257 != 253:
return False
if (a[3] & a[4]) != 96:
return False
if (a[5] | a[6]) != 123:
return False
if (a[0] ^ a[7]) + (a[1] ^ a[6]) != 170:
return False
if (a[2] << 8) | a[3] != 28016:
return False
if a[4] * a[5] != 5508:
return False
if (a[0] * a[7]) % 257 != 155:
return False
if (a[1] + a[6]) ^ (a[0] + a[7]) != 204:
return False
return True
def mystery(x):
import hashlib
if isinstance(x, bool):
return False
# Accept str or int (int is interpreted as its base-10 text form).
if isinstance(x, int):
data = str(x).encode("utf-8")
elif isinstance(x, str):
data = x.strip().encode("utf-8")
else:
return False
# --- Reconstruct hidden target plaintext (bytes) ---
# plaintext length = 21
p = [5, 0, 20, 7, 14, 3, 18, 1, 9, 16, 11, 4, 19, 2, 17, 13, 6, 10, 15, 12, 8]
masked = [96, 126, 20, 224, 204, 101, 9, 147, 168, 112, 6, 225, 31, 25, 226, 142, 130, 155, 165, 35, 155]
def m(i):
A = i * 73 + 41
B = i * 17 + 99
C = i * i + 7
return (A ^ B ^ C) & 0xFF
secret = bytearray(21)
for i, j in enumerate(p):
secret[j] = masked[i] ^ m(i)
secret = bytes(secret)
# --- Reconstruct hidden BLAKE2s key (bytes) ---
enc = [27, 115, 223, 19, 114, 98, 189, 50, 33, 30, 204, 25, 233, 231, 183, 243]
def km(i):
return ((i * 91 + 13) ^ (i * i * 3 + 55)) & 0xFF
key = bytearray(16)
for i, ev in enumerate(enc):
key[15 - i] = ev ^ km(i)
key = bytes(key)
# Require exact length match to keep the search space crisp.
if len(data) != len(secret):
return False
# A reversible pre-hash scrambling layer (XOR stream; keystream independent of input bytes).
def scramble(msg: bytes) -> bytes:
st = 0xC0FFEE12
out = bytearray(len(msg))
for i, b in enumerate(msg):
st = (st * 1103515245 + 12345 + i) & 0xFFFFFFFF
ks = ((st >> 16) & 0xFF) ^ ((i * 29 + 7) & 0xFF)
out[i] = b ^ ks
return bytes(out)
def digest(msg: bytes) -> bytes:
return hashlib.blake2s(scramble(msg), key=key, digest_size=16).digest()
return digest(data) == digest(secret)
def mystery(x):
MASK64 = (1 << 64) - 1
MASK32 = (1 << 32) - 1
def u32(v): return v & MASK32
def u64(v): return v & MASK64
def rotl32(v, r):
v = u32(v)
r &= 31
return u32((v << r) | (v >> (32 - r)))
# Feistel round function
def F(r, k):
r = u32(r + k)
r ^= rotl32(r, 7)
r = u32(r * 0xDEADBEEF) # odd constant
r ^= (r >> 16)
r = u32(r + 0xCAFEBABE)
r ^= rotl32(r, 13)
return u32(r)
# Round key generation
def gen_keys(seed):
keys = []
s = u32(seed)
for _ in range(4):
s = u32(s * 1103515245 + 12345)
keys.append(u32(s ^ (s >> 16)))
return keys
# Main transformation T
def T(v):
v = u64(v)
v ^= 0x123456789ABCDEF0
v = u64(v * 0x9E3779B97F4A7C15) # odd constant
# 4‑round Feistel
L = u32(v >> 32)
R = u32(v)
keys = gen_keys(0xDEADBEEF)
for k in keys:
L, R = R, u32(L ^ F(R, k))
v = u64((L << 32) | R)
v ^= 0xFEDCBA9876543210
return u64(v)
# Reconstruct the hidden secret integer (little‑endian bytes)
def _secret_u64():
masked = [0x84, 0xF5, 0x68, 0x32, 0xA3, 0x4C, 0x9E, 0xB6]
perm = [3, 1, 4, 0, 6, 2, 7, 5]
b = bytearray(8)
for i in range(8):
m = (i * 0x55 + 0xAA) & 0xFF
b[perm[i]] = masked[i] ^ m
return int.from_bytes(b, "little") & MASK64
# Parse input
if isinstance(x, bool):
return False
if isinstance(x, int):
u = x
elif isinstance(x, str):
s = x.strip().replace("_", "")
try:
u = int(s, 0)
except Exception:
return False
else:
return False
if not (0 <= u < (1 << 64)):
return False
target = T(_secret_u64())
return T(u) == target
def mystery(x):
import hashlib
if isinstance(x, bool):
return False
# Accept str or int (int is interpreted as its base-10 text form).
if isinstance(x, int):
data = str(x).encode("utf-8")
elif isinstance(x, str):
data = x.strip().encode("utf-8")
else:
return False
# --- Reconstruct hidden target plaintext (bytes) ---
# plaintext length = 24
p = [5, 0, 20, 7, 14, 3, 18, 1, 9, 16, 11, 4, 19, 2, 17, 13, 6, 10, 15, 12, 8, 21, 23, 22]
masked = [32, 72, 5, 221, 162, 106, 98, 163, 187, 127, 28, 141, 31, 64, 211, 143, 168, 241, 246, 45, 148, 28, 124, 124]
def m(i: int) -> int:
A = (i * 73 + 41) & 0xFF
B = (i * 17 + 99) & 0xFF
C = (i * i + 7) & 0xFF
return (A ^ B ^ C) & 0xFF
secret = bytearray(24)
for i, j in enumerate(p):
secret[j] = masked[i] ^ m(i)
secret = bytes(secret)
# --- Reconstruct hidden BLAKE2s key (bytes) ---
enc = [94, 32, 225, 36, 65, 51, 254, 33, 77, 25, 157, 56, 210, 250, 237, 202]
def km(i: int) -> int:
return (((i * 91 + 13) ^ (i * i * 3 + 55)) & 0xFF)
key = bytearray(16)
for i, ev in enumerate(enc):
key[15 - i] = ev ^ km(i)
key = bytes(key)
# Require exact length match (keeps the search space crisp).
if len(data) != len(secret):
return False
# Reversible pre-hash scrambling layer (XOR stream + tiny bytewise rotation).
def rol8(v, r):
r &= 7
return ((v << r) | (v >> (8 - r))) & 0xFF
def scramble(msg: bytes) -> bytes:
st = 0x6D5A56DA # fixed internal state
out = bytearray(len(msg))
for i, b in enumerate(msg):
st = (st * 1664525 + 1013904223 + i * 97) & 0xFFFFFFFF
ks = ((st >> 16) & 0xFF) ^ ((i * 41 + 19) & 0xFF)
out[i] = rol8(b ^ ks, (st >> 29) & 7)
return bytes(out)
def digest(msg: bytes) -> bytes:
return hashlib.blake2s(scramble(msg), key=key, digest_size=16).digest()
return digest(data) == digest(secret)