encryption - simple encrypt/decrypt lib in python with private key -
encryption - simple encrypt/decrypt lib in python with private key -
is there simple way encrypt/decrypt string key.
somthing like:
key = '1234' string = 'hello world' encrypted_string = encrypt(key, string) decrypt(key, encrypted_string)
i couldn't find simple that.
http://www.dlitz.net/software/pycrypto/ should want.
taken docs page.
>>> crypto.cipher import des >>> obj=des.new('abcdefgh', des.mode_ecb) >>> plain="guido van rossum space alien." >>> len(plain) 34 >>> obj.encrypt(plain) traceback (innermost last): file "<stdin>", line 1, in ? valueerror: strings des must multiple of 8 in length >>> ciph=obj.encrypt(plain+'xxxxxx') >>> ciph '\021,\343nq\214dy\337t\342pa\372\255\311s\210\363,\300j\330\250\312\347\342i\3215w\03561\303dgb/\006' >>> obj.decrypt(ciph) 'guido van rossum space alien.xxxxxx'
python encryption
Comments
Post a Comment