Crypto - Shuffling as a Service
You'll be 'shuffed to bits after trying the Krusty Krab's new bit shuffling service™!
Challenge
class BitOfShuffling:
def __init__(self, key_length):
self.perm = [x for x in range(key_length)]
shuffle(self.perm)
def shuffle_int(self, input_int: int):
shuffled_int = 0
for x in range(len(self.perm)):
shuffled_int |= ((input_int >> x) & 1) << self.perm[x]
return shuffled_int
def shuffle_bytes(self, input_bytes):
return self.shuffle_int(int.from_bytes(input_bytes, 'big'))
Exploit

Implementation
Last updated