2 This module provides utilities related to or using 3DES symmetric encryption algorithm
13 This class provides implementation of triple DES algorithm which uses MD5 hash of password as a key (it uses 16-byte key so it is triple DES with 2 keys)
19 padmode = pyDes.PAD_PKCS5
23 Sets up the class for use
25 @param password password to use for key generation
33 self.
DES3DES3 = pyDes.triple_des(
39 Encrypts data with 3DES ECB algorithm
41 @param data data to be encrypted
43 @returns base64-encoded 3DES encrypted string
46 return base64.encodebytes(cipher).decode(
"ASCII").strip()
50 Decodes and decrypts Base64-encoded 3DES-encrypted data
52 @param cipher base64-encoded encrypted data to decrypt
54 @returns decrypted string
56 cipher = base64.decodebytes((cipher).encode(
"ASCII"))
58 data = data.decode(
"ASCII")
This class provides implementation of triple DES algorithm which uses MD5 hash of password as a key (...
def decrypt(self, cipher)
Decodes and decrypts Base64-encoded 3DES-encrypted data.
def encrypt(self, data)
Encrypts data with 3DES ECB algorithm.
def __init__(self, password)
Sets up the class for use.