encryption and decryption functioning correctly