vietstars/base58

Base58 encoder and decoder for arbitrary data

v0.0.3 2023-12-25 07:58 UTC

This package is auto-updated.

Last update: 2025-05-25 11:26:44 UTC


README

Install

$ composer require vietstars/base58

Usage

$base58 = new Vietstars\Base58;

$encoded = $base58->encode(random_bytes(256));
$decoded = $base58->decode($encoded);

If you are encoding to and from integer use the implicit decodeInteger() and encodeInteger() methods.

$integer = $base58->encodeInteger(987654321); 
print $base58->decodeInteger("1TFvCj", true); 

Also note that encoding a string and an integer will yield different results.

$string = $base58->encode("987654321"); 
$integer = $base58->encodeInteger(987654321);