from Crypto.Cipher import DES def double_des_encrypt(key, plaintext): cipher = DES.new(key[:8], DES.MODE_ECB) # 第一个DES加密 ciphertext = cipher.encrypt(plaintext) cipher = DES.new(key[8:]