Fix bug in base64 encoding the last 3 bytes when they had the high bit set.
This bug was due to declaring the byte pointer as int8_t rather than uint8_t.
Also the encoding could fail for encoding less than 3 bytes, this has also been fixed.
Tested encoding random data of random length between 1 and 1000 bytes over a million times with no mismatches between the random data and its value after encoding and decoding.