Restart!
After reflecting for a bit, I took an entirely new approach to the b64 encoder.
The basic idea now is to use for loops to generate hashmaps for converting hex chars to 4-bit patterns, and from 6-bit patterns to B64 encoding chars. After that, all that was left for the simple encoder was to change the chunk size of the bit sequence from 4 to 6 using the partition function. So: hex->4bit->6bit->b64chars This seems rather brute-force but it's dead simple and should be quite fast. It also avoids all the Java interop conversion calls.
After that, I tackled padding. My version of this seems a bit clunky and there are probably prettier ways of doing it. Any takers?
See
https://github.com/boston-clojure/cryptfun/blob/master/src/cryptfun/matasanob64.clj What do you think of my approach? Did any of you finish your own versions? Please share!
Mark