Improve encrypt/decrypt algorithms