Implementation of decryption function. Tested for encryption/decryption