import hashlib;
from Crypto.Cipher import DES3
import base64
def create_key(sk):
r=hashlib.md5(sk).digest()return s
key=‘2345‘#秘钥
b2bpwd="oohbv"
keys=create_key(key)
ss=init_str(b2bpwd)
des3=DES3.new(keys,DES3.MODE_ECB)
res2=des3.encrypt(ss)
b2bencryptkey= base64.standard_b64encode(res2)
print b2bencryptkey
原文地址:http://blog.csdn.net/fanyunlei/article/details/37651343