crawler-api-node/library/base58.php
2021-08-07 13:43:53 +03:00

17 lines
396 B
PHP

<?php
class Base58 {
const AVAILABLE_CHARS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
public static function encode($num, $length = 58): string {
return Crypto::dec2base($num, $length, self::AVAILABLE_CHARS);
}
public static function decode(string $addr, int $length = 58): string {
return Crypto::base2dec($addr, $length, self::AVAILABLE_CHARS);
}
}