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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -