new encryption logic (not finished yet)