The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Encode::Base58::GMP - High speed Base58 encoding using GMP with BigInt and MD5 support

SYNOPSIS

        use Encode::Base58::GMP;

        # Decimal Conversion

        $base58                 = encode_base58( $decimal );
        $decimal                = decode_base58( $base58 );

        # Hexidecimal (and Arbitrary Base) Conversion

        $base58                 = encode_base58( $hex_string, 16 );
        $hex_string             = decode_base58( $base58, 16 );

        # Using GMP Base58 Strings ( Standard is Flickr )

        $base58_as_gmp          = encode_base58( $decimal, undef, 1 );
        $decimal                = decode_base58( $base58_as_gmp, undef, 1 );

        # Convert between Flickr and GMP

        $base58_as_gmp          = base58_flickr_to_gmp( $base58_as_flickr );
        $base58_as_flickr       = base58_gmp_to_flickr( $base58_as_gmp );

        # Create a Base58 encoded MD5 digest

        $md5_base58             = md5_base58( $data );

DESCRIPTION

Encode::Base58::GMP is a base58 encoder/decoder implementation using The GNU Multiple Precision Arithmetic Library (GMP) with transcoding between GMP and Flickr Base58 implementations.

The default (aka Flickr) usage excludes [0OIl] to improve human readability.

The GMP implementation uses the [0-9A-Za-v] character set.

A md5_base58 function is included to provide MD5 digests.

FUNCTIONS

encode_base58 ( $number [, $base, $use_gmp ] )

This routine encodes a $number in Base58. By default, a decimal number is assumed. If $base is included, the number is treated as a string representation in that encoding, e.g. 16 for hexadecimal, 10 for decimal.

decode_base58 ( $base58 [, $base, $use_gmp ] )

This routine decodes a Base58 value and returns a decimal number by default. If $base is included, the number is returned is encoded as such.

base58_flickr_to_gmp( $base58_as_flickr )

This routine converts a Flickr Base58 string to a GMP Base58 string. This routine is not exported by default.

base58_gmp_to_flickr( $base58_as_gmp )

This routine converts a GMP Base58 string to a Flickr Base58 string. This routine is not exported by default.

md5_base58( $data [, $use_gmp ] )

This routine returns a MD5 digest in Base58. This routine is not exported by default.

SEE ALSO

Encode::Base58, Encode::Base58::BigInt, Math::GMPz, Digest::MD5

http://www.flickr.com/groups/api/discuss/72157616713786392/

http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html (Base62 with GMP in PHP)

AUTHOR

John Wang <john@johnwang.com>

COPYRIGHT AND LICENSE (The MIT License)

Copyright (c) 2011 John Wang <john@johnwang.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.