2 This module provides utilities related to or using 3DES symmetric encryption algorithm 12 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) 18 padmode = pyDes.PAD_PKCS5
22 Sets up the class for use 24 @param password password to use for key generation 26 self.
password = password.encode(
"ASCII", errors=
"replace")
36 Encrypts data with 3DES ECB algorithm 38 @param data data to be encrypted 40 @returns base64-encoded 3DES encrypted string 43 return base64.encodebytes(cipher).decode(
"ASCII").strip()
47 Decodes and decrypts Base64-encoded 3DES-encrypted data 49 @param cipher base64-encoded encrypted data to decrypt 51 @returns decrypted string 53 cipher = base64.decodebytes((cipher).encode(
"ASCII"))
55 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.