Base58 Encode and Decode using PHP

stephenhill/base58 library

  1. Add stephenhill/base58 library to composer.json file:
"require": {
    "stephenhill/base58": "^1.1"
}
  1. Install library from the command line:
composer install
  1. Encode and decode data using Base58:
<?php

use StephenHill\Base58;

require_once __DIR__ . '/vendor/autoload.php';

$base58 = new Base58();

$text = 'Hello';
$base58Str = $base58->encode($text);
echo $base58Str.PHP_EOL;

$text = $base58->decode($base58Str);
echo $text.PHP_EOL;

Leave a Comment

Cancel reply

Your email address will not be published.