encode and decode now accept arrays of integers, strings of bytes and bytearrays; all values returned are now bytearrays