Created
July 24, 2021 08:51
-
-
Save NoHatCoder/c8d7c72825f8167a97fc9ec2ac711c3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def key_bits(): | |
while True: | |
for byte in key: | |
for i in range(8): | |
yield (byte >> i) & 1 | |
key_bits = key_bits() | |
state = [0, 1] * 512 | |
mid = int(len(state) / 2) | |
# 2^16 rounds | |
for _ in range(2 ** 16): | |
l = state[:mid] | |
r = state[mid:] | |
state = [] | |
while l or r: | |
if next(key_bits): | |
state.append(l.pop()) | |
state.append(r.pop()) | |
else: | |
state.append(r.pop()) | |
state.append(l.pop()) | |
state = list(state)[:512] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment