Finished function to encrypt a message