def mystery(x):
import hashlib
if type(x) is not str or len(x) != 1000000:
return False
try:
y = bytes(
ord(ch) ^ ((73 * i + 19) & 255)
for i, ch in enumerate(x)
)
except ValueError:
return False
return hashlib.sha256(y).digest()[::-1].hex() == (
"d02c11c7cc396d040e2097a4489a80f1673ed784e2c7a18192fb14995c6ec7cd"
)
def mystery(x):
import hashlib
if type(x) is not str or len(x) != 8:
return False
return hashlib.sha256(x.encode()).hexdigest() == "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
def mystery(x):
if type(x) is not int:
return False
n = 10941738641570527421809707322040357612003732945449205990913842131476349984288934784717997257891267332497625752899781833797076537244027146743531593354333897
return 1 < x and x * x < n and n % x == 0
def mystery(x):
if type(x) is not int:
return False
n = 9999999999999999993800000000000000000861
return 1 < x and x * x < n and n % x == 0
def mystery(x):
if type(x) is not str or len(x) != 20:
return False
import hashlib
import hmac
key = bytes(((197 * ord(ch) + 123) & 255) for ch in x)
tag = hmac.new(key, b"Hi There", hashlib.sha256).digest()
return hmac.compare_digest(
tag[::-1].hex(),
"f7cf322e6c37e926a73d83c900c21d882bf10bafceafa85c5338dbd8614c34b0",
)
def mystery(x):
if type(x) is not int:
return False
n = 2000000000000000000000000000000000000000000000000013000000000000000000000000000000000021
return 1 < x and x * x < n and n % x == 0
def mystery(x):
if type(x) is not str or len(x) != 32:
return False
try:
key = bytes(
ord(ch) ^ ((139 * i + 17) & 255)
for i, ch in enumerate(x)
)
except ValueError:
return False
import struct
def rot(v, n):
return ((v << n) & 0xffffffff) | (v >> (32 - n))
def qr(a, b, c, d):
a = (a + b) & 0xffffffff
d ^= a
d = rot(d, 16)
c = (c + d) & 0xffffffff
b ^= c
b = rot(b, 12)
a = (a + b) & 0xffffffff
d ^= a
d = rot(d, 8)
c = (c + d) & 0xffffffff
b ^= c
b = rot(b, 7)
return a, b, c, d
state = list(struct.unpack(
"<16I",
b"expand 32-byte k"
+ key
+ b"\x01\x00\x00\x00\x00\x00\x00\x09\x00\x00\x00\x4a\x00\x00\x00\x00",
))
work = state[:]
for _ in range(10):
work[0], work[4], work[8], work[12] = qr(work[0], work[4], work[8], work[12])
work[1], work[5], work[9], work[13] = qr(work[1], work[5], work[9], work[13])
work[2], work[6], work[10], work[14] = qr(work[2], work[6], work[10], work[14])
work[3], work[7], work[11], work[15] = qr(work[3], work[7], work[11], work[15])
work[0], work[5], work[10], work[15] = qr(work[0], work[5], work[10], work[15])
work[1], work[6], work[11], work[12] = qr(work[1], work[6], work[11], work[12])
work[2], work[7], work[8], work[13] = qr(work[2], work[7], work[8], work[13])
work[3], work[4], work[9], work[14] = qr(work[3], work[4], work[9], work[14])
block = struct.pack(
"<16I",
*[(work[i] + state[i]) & 0xffffffff for i in range(16)]
)
target = int(
"4e3c50a2e883d0cbb94e16ded19c12b5"
"a2028bd905d7c21409aa9f07466482d2"
"4e6cd4c39aaa22040368c033c7f4d1c7"
"c47120a31fdd0f5015593bd1e4e7f110",
16,
)
return int.from_bytes(block, "little") == target
def mystery(x):
if type(x) is not int:
return False
n = 10000000000000000002800000000000000000147
return 1 < x and x * x < n and n % x == 0
def mystery(x):
if type(x) is not str or len(x) != 128:
return False
try:
sig = bytes.fromhex(x)[::-1]
except ValueError:
return False
import hashlib
p = 2**255 - 19
q = 2**252 + 27742317777372353535851937790883648493
def inv(z):
return pow(z, p - 2, p)
d = (-121665 * inv(121666)) % p
I = pow(2, (p - 1) // 4, p)
def xrecover(y):
xx = ((y * y - 1) * inv(d * y * y + 1)) % p
r = pow(xx, (p + 3) // 8, p)
if (r * r - xx) % p != 0:
r = (r * I) % p
if (r * r - xx) % p != 0:
return None
if r & 1:
r = p - r
return r
By = (4 * inv(5)) % p
B = (xrecover(By), By)
def oncurve(P):
x0, y0 = P
return (-x0 * x0 + y0 * y0 - 1 - d * x0 * x0 * y0 * y0) % p == 0
def decode(s):
if len(s) != 32:
return None
y = int.from_bytes(s, "little") & ((1 << 255) - 1)
if y >= p:
return None
x0 = xrecover(y)
if x0 is None:
return None
if (x0 & 1) != (s[31] >> 7):
x0 = p - x0
P = (x0, y)
return P if oncurve(P) else None
def add(P, Q):
x1, y1 = P
x2, y2 = Q
z = (d * x1 * x2 * y1 * y2) % p
return (
((x1 * y2 + x2 * y1) * inv(1 + z)) % p,
((y1 * y2 + x1 * x2) * inv(1 - z)) % p,
)
def mul(P, n):
R = (0, 1)
while n:
if n & 1:
R = add(R, P)
P = add(P, P)
n >>= 1
return R
pk = bytes.fromhex(
"258090481591eb5dac0333ba13ed160858f03002d07ea48da3a118628ecd51fc"
)[::-1]
msg = bytes.fromhex("af82")
A = decode(pk)
R = decode(sig[:32])
S = int.from_bytes(sig[32:], "little")
if A is None or R is None or S >= q:
return False
h = int.from_bytes(hashlib.sha512(sig[:32] + pk + msg).digest(), "little") % q
return mul(B, S) == add(R, mul(A, h))
def mystery(x):
if type(x) is not str or len(x) != 43:
return False
import hashlib
return hashlib.sha256(x.encode()).hexdigest() == "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2"