You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
396 B
16 lines
396 B
<?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); |
|
} |
|
}
|
|
|