def DecryptOne(path, key, signature): with open(path, 'rb') as fin: org = fin.read() lsz = len(signature) if org[:lsz] != signature: return org return CipherMod.decrypt(org[lsz:], key)
def EncryptOne(path, key, signature): with open(path, 'rb') as fin: org = fin.read() if org[:len(signature)] == signature: return org return signature + CipherMod.encrypt(org, key)