Implement Base-64 encoding instead of using the Ruby stdlib

This is a naive implementation that doesn't handle '=' padding.