Convert::Base91 - XS base91 encoding/decoding
use Convert::Base91 qw/encode_base91 decode_base91/; # procedural interface my $encoded = encode_base91 'some data'; say $encoded; # qrLg,W;Hr%w my $decoded = decode_base91 $encoded; say $decoded; # some data # OO interface my $base91 = Convert::Base91->new; $base91->encode('some '); $base91->encode('data'); my $enc = $base91->encode_end; say $enc; # qrLg,W;Hr%w $base91->decode('qrLg,'); $base91->decode('W;Hr%w'); my $dec = $base91->decode_end; say $dec; # some data
Base91 is a method for encoding binary data as printable ASCII characters. Every two base91 characters (16 bits) encode 13 or 14 bits of actual data, thus the overhead is between 14% and 23%, an improvement over base64's overhead of 33%.
This module provides a procedural interface for encoding/decoding whole strings and an OO interface for encoding/decoding in chunks.
The encode_base91 and decode_base91 functions are available for export, but are not exported by default.
encode_base91
decode_base91
Takes a string containing arbitrary bytes and returns the base91 encoded data.
Takes a string containing base91 encoded data and returns the decoded string of arbitrary bytes. Any non-printable character in the input is silently ignored.
Create a new Convert::Base91 object to keep the state for a chunk encoding/decoding operation.
Convert::Base91
Submit the next chunk of arbitrary binary data to be encoded. Returns nothing.
Signals that all chunks of data to be encoded have been submitted. Returns the base91 encoded data, and clears the state of the $base91 object so it may be used again (for either encoding or decoding).
Submit the next chunk of base91 data to be decoded. Returns nothing. Any non-printable character in the input is silently ignored.
Signals that all chunks of data to be decoded have been submitted. Returns the decoded data, and clears the state of the $base91 object so it may be used again (for either encoding or decoding).
http://base91.sourceforge.net/
Convert::Ascii85 provides a constant-length encoding, at the cost of a larger overhead (25% for Ascii85, versus 33% for base64 and 14-23% for base91).
Marius Gavrilescu, <marius@ieval.ro>
Copyright (C) 2017-2018 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.26.1 or, at your option, any later version of Perl 5 you may have available.
To install Convert::Base91, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Convert::Base91
CPAN shell
perl -MCPAN -e shell install Convert::Base91
For more information on module installation, please visit the detailed CPAN module installation guide.