def mystery(x):
s = str(x)
if len(s) == 0:
return False
# Calculate product of ASCII values
product = 1
for c in s:
product *= ord(c)
# Check if divisible by 1000 and length is at most 3
return product % 1000 == 0 and len(s) <= 3
import hashlib
import re
def mystery(x):
# Normalize to a string, but in a slightly non-obvious way.
# For floats like 1.0 we keep Python's str() representation.
s = str(x)
# Basic shape constraints
if not (8 <= len(s) <= 40):
return False
if not re.fullmatch(r"[A-Za-z0-9_\-\.]+", s):
return False
# Keyed-looking check without an explicit key:
# We use SHA-256 of (s + separator + reversed(s)).
h = hashlib.sha256((s + "|" + s[::-1]).encode("utf-8")).hexdigest()
# Two-layer condition:
# 1) Require a specific hex pattern at spaced positions.
# 2) Require the digest to end with a rare suffix.
pick = h[1] + h[7] + h[12] + h[19] + h[23]
return (pick == "c0de5") and h.endswith("b00b")
def mystery(x):
s = str(x)
# Only accept strings that are pure digits
if not s.isdigit():
return False
if len(s) == 0:
return False
# Calculate sum and product of digits
digit_sum = sum(int(c) for c in s)
digit_prod = 1
for c in s:
digit_prod *= int(c)
# Check if sum is prime
if digit_sum < 2:
return False
is_prime = True
for i in range(2, int(digit_sum**0.5) + 1):
if digit_sum % i == 0:
is_prime = False
break
# Check if product is a perfect square
sqrt_prod = int(digit_prod**0.5)
is_perfect_square = sqrt_prod * sqrt_prod == digit_prod
return is_prime and is_perfect_square
import hashlib
import base64
import zlib
import re
def mystery(x):
s = str(x)
# Shape constraints (tight enough to prune brute force, but not obvious)
if not (10 <= len(s) <= 40):
return False
if not re.fullmatch(r"[A-Za-z0-9_.\-]+", s):
return False
if s[0] in "._-" or s[-1] in "._-":
return False
if ".." in s or "__" in s or "--" in s:
return False
# Derive a "mask" from the string itself
h = hashlib.sha256((s + "|" + s[::-1]).encode("utf-8")).digest()
mask = bytes(b ^ 0xA5 for b in h[:12])
# Compress the plaintext, then XOR with the mask (repeated)
plain = s.encode("utf-8")
comp = zlib.compress(plain, 9)
key = (mask * ((len(comp) // len(mask)) + 1))[:len(comp)]
cipher = bytes(a ^ b for a, b in zip(comp, key))
# Base64 encode, then hash again with some index-picking
b64 = base64.urlsafe_b64encode(cipher).decode("ascii").rstrip("=")
d = hashlib.sha256((b64 + ":" + s).encode("utf-8")).hexdigest()
# Rare-looking conditions on the digest + a small checksum on b64
pick = d[0] + d[5] + d[17] + d[42] + d[63]
chk = sum(ord(c) for c in b64) % 97
return pick == "0a1f9" and chk == 42
def mystery(x):
s = str(x)
if not s or len(s) > 10:
return False
# Convert to list of ord values
ords = [ord(c) for c in s]
# Check if sum of ords is a perfect cube
total = sum(ords)
cube_root = round(total ** (1/3))
if cube_root ** 3 != total:
return False
# Check product of (position + 1) values (factorial of length)
pos_product = 1
for i in range(len(s)):
pos_product *= (i + 1)
# Check XOR of all ord values
xor_val = 0
for o in ords:
xor_val ^= o
# Additional constraint on first character
first_ord = ords[0] if ords else 0
return pos_product == 720 and xor_val == 0 and first_ord < 40
import hashlib
import re
import zlib
import base64
def mystery(x):
s = str(x)
# Tight shape constraints to reduce naive guessing
if not (12 <= len(s) <= 28):
return False
if not re.fullmatch(r"[A-Za-z0-9_]+", s):
return False
if s[0].isdigit() or s[-1].isdigit():
return False
if "__" in s:
return False
# Self-keyed transform: compress then XOR with a key derived from s itself
raw = s.encode("utf-8")
comp = zlib.compress(raw, 9)
key = hashlib.blake2s((s + "|" + s[::-1]).encode("utf-8"), digest_size=16).digest()
stream = (key * ((len(comp) // len(key)) + 1))[:len(comp)]
xored = bytes(a ^ b for a, b in zip(comp, stream))
token = base64.urlsafe_b64encode(xored).decode("ascii").rstrip("=")
# Final check: pick scattered nibbles from a strong hash, plus a checksum on token
h = hashlib.sha256((token + ":" + s).encode("utf-8")).hexdigest()
pick = h[2] + h[11] + h[23] + h[37] + h[58] # 5 hex chars
chk = sum(token.encode("utf-8")) % 97
return (pick == "7c0de") and (chk == 73)
def mystery(x):
s = str(x)
# Must be exactly 5 characters
if len(s) != 5:
return False
# Must contain only digits
if not s.isdigit():
return False
# Convert to list of integers
digits = [int(c) for c in s]
# Sum of digits must equal 20
if sum(digits) != 20:
return False
# Product of non-zero digits must be divisible by 18
product = 1
for d in digits:
if d != 0:
product *= d
if product == 1 or product % 18 != 0:
return False
# Alternating sum: d[0] - d[1] + d[2] - d[3] + d[4]
alt_sum = digits[0] - digits[1] + digits[2] - digits[3] + digits[4]
if alt_sum % 3 != 0:
return False
return True
import hashlib
import hmac
import re
def mystery(x):
s = str(x)
# Shape constraints (so random brute force is annoying, but still possible)
if not (16 <= len(s) <= 22):
return False
if not re.fullmatch(r"[A-Za-z0-9_-]+", s):
return False
if s[0] in "_-" or s[-1] in "_-":
return False
if "__" in s or "--" in s or "_-" in s or "-_" in s:
return False
# Derive a secret-looking key from the string itself (so there's no obvious external key)
key = hashlib.blake2s((s[::-1] + "|" + str(len(s))).encode("utf-8"), digest_size=16).digest()
# HMAC over a structured message that depends on s in a nontrivial way
msg = (s + "|" + s.swapcase() + "|" + s[::2] + "|" + s[-1::-2]).encode("utf-8")
digest = hmac.new(key, msg, hashlib.sha256).hexdigest()
# Pick scattered hex nibbles, plus a checksum constraint on the digest itself
pick = digest[1] + digest[9] + digest[17] + digest[33] + digest[61]
chk = sum(int(c, 16) for c in digest[::4]) % 97
return pick == "a1c0e" and chk == 52
def mystery(x):
s = str(x)
if len(s) < 3 or len(s) > 7:
return False
# Must be alphanumeric
if not s.isalnum():
return False
# Calculate weighted sum: position * ASCII value
weighted_sum = sum((i + 1) * ord(c) for i, c in enumerate(s))
# Must be divisible by 100
if weighted_sum % 100 != 0:
return False
# Sum of ASCII values must be odd
if sum(ord(c) for c in s) % 2 == 0:
return False
# XOR of all ASCII values must be greater than 50
xor_val = 0
for c in s:
xor_val ^= ord(c)
if xor_val <= 50:
return False
return True
import re
import zlib
import binascii
import hashlib
def mystery(x):
s = str(x)
# 1) Shape constraints (prevents lots of "try random stuff" approaches)
if not (18 <= len(s) <= 26):
return False
if not re.fullmatch(r"[a-z2-7]+", s): # base32 alphabet without padding, lowercase only
return False
if any(ch*3 in s for ch in "abcdefghijklmnopqrstuvwxyz234567"):
return False # no triple repeats
# 2) Base32-decode (no padding): interpret s as base32 and recover raw bytes
# (We do this manually so it's not obvious what to feed it.)
alphabet = "abcdefghijklmnopqrstuvwxyz234567"
buf = 0
bits = 0
out = bytearray()
for ch in s:
buf = (buf << 5) | alphabet.index(ch)
bits += 5
while bits >= 8:
bits -= 8
out.append((buf >> bits) & 0xFF)
raw = bytes(out)
# Must decode to a very specific byte length range
if not (11 <= len(raw) <= 16):
return False
# 3) "Self-checking" transform: deflate (zlib raw) must succeed
try:
plain = zlib.decompress(raw, wbits=-15)
except Exception:
return False
# 4) The plaintext must look like a structured mini-message
# prefix{hex}:{digits}
try:
p = plain.decode("ascii")
except Exception:
return False
m = re.fullmatch(r"pfx\{([0-9a-f]{8})\}:([0-9]{3})", p)
if not m:
return False
hx = m.group(1)
num = int(m.group(2))
# 5) Cross-checks that tie everything together
# - crc32 of plaintext must match the embedded hex
# - sha256 of raw bytes must have a sparse pattern (annoying to brute force)
if f"{binascii.crc32(plain) & 0xffffffff:08x}" != hx:
return False
h = hashlib.sha256(raw).hexdigest()
pick = h[0] + h[7] + h[19] + h[31] + h[47] + h[63]
return (num % 7 == 0) and (pick == "0c0a1e")