sulaco-tech/base58
Composer 安装命令:
composer require sulaco-tech/base58
包简介
Pretty lightweight implementation of Base58 encoding and deconding algorithms written in PHP.
关键字:
README 文档
README
Pretty lightweight implementation of Base58 encoding and deconding algorithms written in PHP.
Install
Install with composer.
$ composer require sulaco-tech/base58
Requirements
This branch requires PHP 7.0 or up.
Usage
$base58 = new SulacoTech\Base58(); $data = "Hello World!"; $encoded = $base58->encode($data); // "2NEpo7TZRRrLZSi2U" $decoded = $base58->decode($encoded); // "Hello World!"
Character sets
Encoder support few predefined charset sets for coding algorithms:
You can also use any custom 58 characters. By default the encoder uses IPFS style character set.
use SulacoTech\Base58; print Base58::CHARSET_GMP; // 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv print Base58::CHARSET_BITCOIN; // 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz print Base58::CHARSET_FLICKR; // 123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ print Base58::CHARSET_RIPPLE; // rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz print Base58::CHARSET_IPFS; // 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz $base58 = new Base58(Base58::CHARSET_FLICKR); $data = "Hello World!"; $encoded = $base58->encode($data); // "2nePN7syqqRkyrH2t" $decoded = $base58->decode($encoded); // "Hello World!"
Testing
You can run tests with external (global) installation of PHPUnit.
$ phpunit tests
This branch was tested on PHP:
- 7.0.12
- 7.1.9
- 7.2.17
- 7.4.3
License
This library is license under the MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-15