Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### In your xor program
- # your keystream goes there ->
- keystream = [102, 49, 48, 101, 55, ...]
- keystream = bytearray(keystream)
- print(keystream[:32])
- # copy output, you gonna need it later
- exit()
- ### in shitty_cipher.py
- mport argparse
- import sys
- # comment out this shit...
- #parser = argparse.ArgumentParser()
- #parser.add_argument("key")
- #args = parser.parse_args()
- SUB = [0, 1, 1, 0, 0, 1, 0, 1]
- N_B = 32
- N = 8 * N_B
- # Next keystream
- def step(x):
- x = (x & 1) << N+1 | x << 1 | x >> N-1
- y = 0
- for i in range(N):
- y |= SUB[(x >> i) & 7] << i
- return y
- # Keystream init
- # comment this, you dont need it
- # keystr = int.from_bytes(args.key.encode(),'little')
- # instead use bytearray from your keystream
- keystr = int.from_bytes(bytearray(b'...','little')
- for i in range(N//2):
- keystr = step(keystr)
- print(keystr.to_bytes(N_B, 'little'))
- # your key ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement