update encrypt and decrypt algorithms