Adds function to encode/decode directly to unsigned char*