Added a helper function to encrypt and encode / decode and decrypt messages