[Python]使用pyDes.py動態加密解密
45 words
One minute
pyDes Github
1
2
3
4
5
6
7
8
9
10
11
|
from pyDes import *
import base64
import time
import random
data =str(random.random())+"|"+"加密內容"
k = des('DESCRYPT', CBC, '12345675', pad=None, padmode=PAD_PKCS5)
d = k.encrypt(data)
print "Encrypted: %r" % base64.b64encode(d)
print "Decrypted: %r" % k.decrypt(d)
|