gb64 - Fast Pure Perl Base64 Encoding and Decoding SYNOPSIS use gb64 qw(enc_b64 dec_b64); # Direct encoding/decoding my $encoded = enc_b64("Hello World"); # Returns "SGVsbG8gV29ybGQ=" my $decoded = dec_b64($encoded); # Returns "Hello World" # Streaming encoding/decoding my $gb64 = gb64->new; $gb64->add("Hello ")->add("World"); $encoded = $gb64->encode; # Returns "SGVsbG8gV29ybGQ=" DESCRIPTION gb64 is a high-performance, pure Perl implementation of Base64 encoding and decoding, conforming to RFC 4648. It supports both one-shot encoding/decoding and streaming for large or incremental datasets. Optimized with unpack, pack, and array-based lookups, gb64 outperforms other pure Perl implementations like MIME::Base64::Perl by up to 97.7% for large inputs (110k bytes). The module has no XS or C dependencies, making it lightweight and portable. It includes robust error handling for invalid inputs, such as non-Base64 characters or incorrect lengths, and is compatible with Perl 5.8.8 and later. FEATURES - Fast pure Perl implementation with no external dependencies - Compliant with RFC 4648 Base64 specification - Functional interface for one-shot encoding/decoding - Object-oriented streaming interface for large datasets - Robust error handling for invalid inputs - Up to 97.7% faster than MIME::Base64::Perl for large inputs INSTALLATION To install from CPAN: cpan gb64 Or manually: perl Makefile.PL make make test make install DEPENDENCIES - Core Perl modules: strict, warnings, Exporter - Testing: Test::More (>= 0.88), MIME::Base64 TESTING Run the test suite to verify functionality: prove -v t/ The test suite includes functional, streaming, and error-handling tests, using MIME::Base64 as a reference implementation. PERFORMANCE Benchmarks show gb64 achieves: - Encoding: 26.4 iterations/second for large inputs (110k bytes) - Decoding: 24.5 iterations/second for large inputs (110k bytes) Compared to MIME::Base64::Perl, gb64 is up to 97.7% faster for large inputs (26.4/s vs. 1051/s for encoding, 24.5/s vs. 1049/s for decoding). See benchmark.pl in the distribution for details. AUTHOR OnEhIppY, Domero Software COPYRIGHT AND LICENSE Copyright (C) 2025 by OnEhIppY, Domero Software This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the Artistic License which comes with Perl. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL and the Artistic License in /usr/share/common-licenses/Artistic. SUPPORT - Repository: https://github.com/DomeroSoftware/gb64 - Issues: https://github.com/DomeroSoftware/gb64/issues - Email: domerosoftware@gmail.com SEE ALSO - RFC 4648: https://tools.ietf.org/html/rfc4648 - MIME::Base64: A faster XS-based Base64 implementation - MIME::Base64::Perl: Another pure Perl Base64 implementation