{"id":13704535,"url":"https://github.com/stephen-hill/base58php","last_synced_at":"2025-05-05T10:30:28.723Z","repository":{"id":16286016,"uuid":"19034530","full_name":"stephen-hill/base58php","owner":"stephen-hill","description":"Base58 Encoding and Decoding Library for PHP","archived":false,"fork":false,"pushed_at":"2023-08-10T14:38:19.000Z","size":74,"stargazers_count":79,"open_issues_count":4,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T17:38:20.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephen-hill.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-04-22T15:16:14.000Z","updated_at":"2024-06-10T09:04:16.000Z","dependencies_parsed_at":"2024-01-12T10:25:59.274Z","dependency_job_id":"e0e2aa56-4579-450c-9885-172665657805","html_url":"https://github.com/stephen-hill/base58php","commit_stats":{"total_commits":92,"total_committers":6,"mean_commits":"15.333333333333334","dds":0.06521739130434778,"last_synced_commit":"1f4b0c1115e88784a321fa5574a9688ea4d7e646"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephen-hill%2Fbase58php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephen-hill%2Fbase58php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephen-hill%2Fbase58php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephen-hill%2Fbase58php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephen-hill","download_url":"https://codeload.github.com/stephen-hill/base58php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224440003,"owners_count":17311570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T21:01:11.690Z","updated_at":"2024-11-13T11:31:30.883Z","avatar_url":"https://github.com/stephen-hill.png","language":"PHP","funding_links":[],"categories":["目录","密码( Passwords )"],"sub_categories":["密码 Passwords"],"readme":"# Base58 Encoding and Decoding Library for PHP\n\n[![Build Status](https://travis-ci.org/stephen-hill/base58php.png)](https://travis-ci.org/stephen-hill/base58php)\n[![Packagist Release](http://img.shields.io/packagist/v/stephenhill/base58.svg)](https://packagist.org/packages/stephenhill/base58)\n[![MIT License](http://img.shields.io/packagist/l/stephenhill/base58.svg)](https://github.com/stephen-hill/base58php/blob/master/license)\n[![Flattr this](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=stephen-hill\u0026url=https%3A%2F%2Fgithub.com%2Fstephen-hill%2Fbase58php)\n\n## Long Term Support\n\nEach major version of this library will be supported for 5 years after it's initial release. Support will be provided for security and bug fixes.\n\nVersion 1 will therefore be supported until the 11th September 2019.\n\n## Background\n\nI wanted a replacement for Base64 encoded strings and the [Base58 encoding used by Bitcoin](https://en.bitcoin.it/wiki/Base58Check_encoding) looked ideal. I looked around for an existing PHP library which would directly convert a string into Base58 but I couldn't find one, or at least one that worked correctly and was also well tested.\n\nSo I decided to create a library with the following goals:\n\n- Encode/Decode PHP Strings\n- Simple and easy to use\n- Fully Tested\n- Available via Composer\n\n## Requirements\n\nThis library has the following requirements:\n\n- PHP =\u003e 5.3\n- BC Math Extension\n\n## Installation\n\nI recommend you install this library via Composer.\n\n```json\n{\n    \"require\": {\n        \"stephenhill/base58\": \"~1.0\"\n    }\n}\n```\n\n## Basic Usage\n\n```php\nrequire_once('vendor/autoload.php');\n\n$base58 = new StephenHill\\Base58();\n\n$base58-\u003eencode('Hello World');\n$base58-\u003edecode('JxF12TrwUP45BMd');\n```\n\n## Advanced Usage\n\nBy default this library chooses the encoding service provider to use, either GMPService or BCMathService (in that order).\nIf you want to specify one of the included services or your own, you can inject it into the constructor.\n\n```php\nrequire_once('vendor/autoload.php');\n\n$gmp = new StephenHill\\GMPService();\n$base58 = new StephenHill\\Base58(null, $gmp);\n\n$base58-\u003eencode('Hello World');\n$base58-\u003edecode('JxF12TrwUP45BMd');\n```\n\nAlso by default, this library uses Bitcoin's Base58 alphabet. If you want to use another variant, you can do this in the constructor.\n\n```php\nrequire_once('vendor/autoload.php');\n\n// Flickr's Base58 Alphabet\n$base58 = new StephenHill\\Base58('123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ');\n\n$base58-\u003eencode('Hello World');\n$base58-\u003edecode('iXf12sRWto45bmC');\n```\n\n## Testing\n\nThis library is tested using PHPUnit.\n\n```bash\n$ bin/phpunit\n```\n\n## Benchmarking\n\nYou can benchmark this library using [Athletic](https://github.com/polyfractal/athletic).\nThe benchmarking suite also benchmarks PHP's built-in Base64 and Base16 encoding for comparison.\n\n```bash\n$ bin/athletic -p benchmarks\n```\n\nExample output.\n\n```\nStephenHill\\Benchmarks\\Base16Event\n    Method Name    Iterations    Average Time      Ops/second\n    ------------  ------------  --------------    -------------\n    encodeBase16: [10,000    ] [0.0000010839939] [922,514.40637]\n    decodeBase16: [10,000    ] [0.0000011516809] [868,296.03561]\n\n\nStephenHill\\Benchmarks\\Base58BCMathEvent\n    Method Name    Iterations    Average Time      Ops/second\n    ------------  ------------  --------------    -------------\n    encodeBase58: [10,000    ] [0.0001500048161] [6,666.45263]\n    decodeBase58: [10,000    ] [0.0001741812706] [5,741.14540]\n\n\nStephenHill\\Benchmarks\\Base58GMPEvent\n    Method Name    Iterations    Average Time      Ops/second\n    ------------  ------------  --------------    -------------\n    encodeBase58: [10,000    ] [0.0001168665648] [8,556.76730]\n    decodeBase58: [10,000    ] [0.0001385705233] [7,216.54199]\n\n\nStephenHill\\Benchmarks\\Base64Event\n    Method Name    Iterations    Average Time      Ops/second\n    ------------  ------------  --------------    -------------\n    encodeBase64: [10,000    ] [0.0000009050369] [1,104,927.29189]\n    decodeBase64: [10,000    ] [0.0000009787321] [1,021,730.04312]\n```\n\n## Contributing\n\nI welcome everyone to contribute to this library. Please see the Contributing document for details.\n\n## License\n\nThis library is license under the MIT License (MIT). Please see License File for more information.\n\n## Credits\n\nThis library was forked from [Jeremy Johnstone's](https://github.com/jsjohnst) Base58 methods on Gist https://gist.github.com/jsjohnst/126883.\n\nSome of the unit tests were based on the following:\n\n- https://code.google.com/p/bitcoinj/source/browse/core/src/test/java/com/google/bitcoin/core/Base58Test.java\n- https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/fixtures/base58.json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephen-hill%2Fbase58php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephen-hill%2Fbase58php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephen-hill%2Fbase58php/lists"}