Skip to content

avenj/convert-z85

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Convert::Z85 - Encode and decode Z85 strings

SYNOPSIS

use Convert::Z85;

my $encoded = encode_z85($binarydata);
my $decoded = decode_z85($encoded);

DESCRIPTION

An implementation of the Z85 encoding scheme (as described in ZeroMQ spec 32) for encoding binary data as plain text.

Modelled on the PyZMQ implementation.

This module uses Exporter::Tiny to export two functions by default: "encode_z85" and "decode_z85".

encode_z85

my $z85 = encode_z85($data);

Takes binary data in 4-byte chunks and returns a Z85-encoded text string.

Per the spec, padding is not performed automatically; the pad option can be specified to pad data with trailing zero bytes:

my $z85 = encode_z85($data, pad => 1);

decode_z85

my $bin = decode_z85($encoded);

Takes a Z85 text string and returns the original binary data.

Dies (with a stack trace) if invalid data is encountered.

Padding (see "encode_z85") is not handled automatically; the pad option can be specified to remove trailing zero bytes:

my $bin = decode_z85($encoded, pad => 1);

SEE ALSO

Convert::Ascii85

POEx::ZMQ

ZMQ::FFI

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>