Helper functions for encryrption / decryption. Takes some of the manual labour out.