go-ruby-base64 is a pure-Go (no cgo) reimplementation of Ruby's standard-library Base64 module โ the deterministic, interpreter-independent core of MRI 4.0.5's require "base64". It reproduces byte-for-byte what MRI computes for every method: the RFC-2045 60-column wrapping of Encode64, the lenient stream semantics of Decode64, the strict variants' error on malformed input, and the url-safe alphabet with optional padding. The hot standard-alphabet paths run on go-simd/base64's go-asmgen kernels โ a CGO=0 SIMD path across all six 64-bit Go arches, bit-identical to encoding/base64.StdEncoding. It is the Base64 backend for go-embedded-ruby, a standalone reusable module bound by rbgo just like go-ruby-regexp, go-ruby-erb and go-ruby-base64 โ differential-tested against MRI, 100% coverage, CI green across 6 arches and 3 OSes.
Encode64 / StrictEncode64 ready
Encode64 is RFC 2045 (pack("m")): the standard +/ alphabet, a newline every 60 output characters and a trailing newline (the empty string encodes to empty). StrictEncode64 is pack("m0") โ same alphabet, no newlines.
Decode64 (lenient) ready
String#unpack1("m") semantics: non-alphabet bytes are skipped, padding is optional, a = on a partial quad finalises and stops decoding, a = on a quad boundary is ignored, and a lone orphaned final sextet is discarded.
Strict & url-safe variants ready
StrictDecode64 (unpack1("m0")) rejects any stray byte โ including the newlines encoding/base64 tolerates โ with ErrInvalid. UrlsafeEncode64 / UrlsafeDecode64 use the -_ alphabet (RFC 4648); padding is on by default and stripped when padding=false.
SIMD acceleration ready
The hot standard-alphabet bodies run on go-simd/base64’s go-asmgen kernels (amd64 SSE/AVX2, arm64 NEON, ppc64le VSX, s390x vector; stdlib fallback elsewhere) โ CGO=0 SIMD across all six 64-bit Go arches, bit-identical to encoding/base64.StdEncoding.
Standalone & reusable ready
A standalone module with no dependency on the Ruby runtime; rbgo binds it as a native module the same way it binds go-ruby-regexp, go-ruby-erb and go-ruby-yaml. Argument coercion and raising ArgumentError are the host’s job; the library returns a Go error.
Differential oracle & coverage ready
A wide corpus โ every length class, a line wrap, non-ASCII bytes and malformed/strict inputs โ driven through the system ruby and asserted byte-equal; 100% coverage, gofmt + go vet clean, green across all six 64-bit Go arches and three OSes.
- ready capability complete (exit criteria met, nothing material left)
- active in progress (substantial work shipped, not yet finished)
- planned not started yet (or downstream by design)
A faithful port of MRI's Base64 in pure Go, cgo disabled, so it cross-compiles and embeds anywhere. The standard-alphabet encode/decode bodies run on go-simd/base64's SIMD kernels across all six 64-bit Go arches and stay bit-identical to encoding/base64.StdEncoding; only the MRI-specific framing โ the 60-column wrap, the lenient quad/padding state machine, the url-safe rules โ is hand-written. Validated differentially against the system ruby binary. It is a standalone, reusable module and the Base64 backend for the sibling org github.com/go-embedded-ruby.