Answer the question
In order to leave comments, you need to log in
How to "search" for a specific combination of bytes in PRNG?
There is a pseudo-random number generator - it displays (one byte at a time) a certain combination according to its algorithm:
bytes = ("%02x" % (algo))
sys.stdout.write(bytes)
if bytes == 'd4':
exit(0)
Answer the question
In order to leave comments, you need to log in
# для длинного хвоста
tail = (None, None)
for r in 0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0xf6: # да, вот такой хреновый гпсч
print("%02x" % r)
tail = tail[1:] + (r,)
if tail == (0xd4, 0xe5):
break
# для короткого хвоста
t = None
for r in 0xa1, 0xb2, 0xc3, 0xd4, 0xe5, 0xf6:
print("%02x" % r)
if t == 0xd4 and r == 0xe5:
break
t = r
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question