def encrypt(message, secret_key): cipher = DES.new(secret_key) return urllib.quote(base64.b64encode(cipher.encrypt(des_padding(urllib.quote(message))).encode('hex')))
def encrypt(content, secret_key): content = content.encode('utf-8') cipher = DES.new(secret_key) return base64.b64encode(cipher.encrypt(des_padding(content)).encode('hex'))