def __init__(self, key, iv): super(StackableRabbit, self).__init__() self.rabbit = Rabbit() self.rabbit.keysetup(key) self.rabbit.ivsetup(iv) self.rabbit.savestate() self.iv = iv
class StackableRabbit(Stackable): def __init__(self, key, iv): super(StackableRabbit, self).__init__() self.rabbit = Rabbit() self.rabbit.keysetup(key) self.rabbit.ivsetup(iv) self.rabbit.savestate() self.iv = iv def process_input(self, data): self.rabbit.restorestate() return bytes(self.rabbit.encrypt(bytearray(data))) def process_output(self, data): self.rabbit.restorestate() return bytes(self.rabbit.encrypt(bytearray(data)))