Hi Andreas, On 16.09.19 11:38, Andreas Tille wrote: > Hi Peter, > > On Sun, Sep 15, 2019 at 02:47:50PM +0100, peter green wrote: >>>> tmp = rt.encrypt('Cycle{}'.format(pickle.dumps(objSave))) >>> >>> Thanks to this hint >> This hint was *wrong*, it will introduce garbage into the string and the >> "rotor" code is clearly designed to work with byte strings, not unicode >> strings. >> >> Change it to >> >> "tmp=rt.encrypt( b'Cycle'+pickle.dumps(objSave) )"
Oops, got that backwards. Thanks for spotting this. > Thanks a lot for your patience. Unfortunately this is not > yet the final solution: > > ... > Traceback (most recent call last): > File "/usr/bin/cycle", line 83, in OnCloseWindow > Save_Cycle(cycle.name, cycle.passwd, cycle.file) > File "/usr/share/cycle/save_load.py", line 46, in Save_Cycle > tmp=rt.encrypt( b'Cycle'+pickle.dumps(objSave) ) > File "/usr/share/cycle/p_rotor.py", line 63, in encrypt > return self.cryptmore(buf, 0) > File "/usr/share/cycle/p_rotor.py", line 88, in cryptmore > c = rotors[i][c ^ pos[i]] > TypeError: unsupported operand type(s) for ^: 'int' and 'float' That code could be patched by using int() around potentially float numbers. But honestly, it should better be ripped out and use real encryption. The docstring tells so: The rotor module has been removed from the Python 2.4 distribution because the rotor module uses an insecure algorithm and is deprecated. ============================================================== Best wishes Michael
signature.asc
Description: OpenPGP digital signature