def encrypt(plain): import pyDes, iPXSettings from binascii import hexlify key = iPXSettings.getVar('3DESKey') key = key.decode('rot-13') k = pyDes.triple_des(key) d = k.encrypt(plain.strip(), ' ') return hexlify(d)
def decrypt(ciph): import pyDes, iPXSettings from binascii import unhexlify ciph = unhexlify(ciph) key = iPXSettings.getVar('3DESKey') key = key.decode('rot-13') k = pyDes.triple_des(key) d = k.decrypt(ciph, ' ') return d