NAME
Convert::Base91 - XS base91 encoding/decoding
SYNOPSIS
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
DESCRIPTION
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 $binary_data
-
Takes a string containing arbitrary bytes and returns the base91 encoded data.
- decode_base91 $base91_data
-
Takes a string containing base91 encoded data and returns the decoded string of arbitrary bytes.
- Convert::Base91->new
-
Create a new
Convert::Base91
object to keep the state for a chunk encoding/decoding operation. - $base91->encode($data)
-
Submit the next chunk of arbitrary binary data to be encoded. Returns nothing.
- $base91->encode_end
-
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).
- $base91->decode($data)
-
Submit the next chunk of base91 data to be decoded. Returns nothing.
- $base91->decode_end
-
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).
SEE ALSO
http://base91.sourceforge.net/
AUTHOR
Marius Gavrilescu, <marius@ieval.ro>
COPYRIGHT AND LICENSE
Copyright (C) 2017 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.