I would take your input array of bytes and using a simple loop, create an array of bits.

Then using a second loop, read those bits 6 at a time and use a combination of math and a lookup table to generate the output.

The wikipedia article on Base64 has a lot of useful info, including C code for encoding and decoding:

http://en.wikipedia.org/wiki/Base64