Skip to content

Instantly share code, notes, and snippets.

@NoHatCoder
Created July 24, 2021 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NoHatCoder/c8d7c72825f8167a97fc9ec2ac711c3a to your computer and use it in GitHub Desktop.
Save NoHatCoder/c8d7c72825f8167a97fc9ec2ac711c3a to your computer and use it in GitHub Desktop.
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