I will post part of the code here because it is to big but you can find the whole thing in the attached file! Also please bear with the bad code since i am a newbie in python and programming in general...
my sources for the CTR so far were: source 1 source 2
But they wont work for the decryption
class Secret(object): def __init__(self, secret=None): if secret is None: secret = os.urandom(8) self.secret = secret self.reset() def counter(self): for i, c in enumerate(self.current): self.current[i] = c + 1 if self.current: break return self.current.tostring() def reset(self): self.current = array.array('B', self.secret) #[...] get keys, PT, CT and confusing stuff [...] ctr = secret.counter des = DES.new(key, DES.MODE_CTR, counter = ctr) output_txt = des.encrypt(input_txt)
Thanks in advance!
Number of downloads: 31