Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from random import Random
def generate_bytes_for_seed(seed: int, message: str) -> bytearray:
data = Random(seed)
garbage = Random(34988394)
result = bytearray()
i = 0
while i < len(message):
c = message[i]
if data.randrange(2):
result.append(data.randrange(256) ^ ord(c))
i += 1
return result
seed = 69420
message = 'Your secret message!'
print(f"""import random
print(''.join(chr(random.randrange(256) ^ c)
for c in bytes.fromhex({repr(generate_bytes_for_seed(seed, message).hex().upper())})
if random.randrange(2)))
Copy link

SoutrikBandyopadhyay commented Jan 6, 2022

@Ernest1338 You are right ! That seed definition in line 7 is redundant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment