davidfricker / basechanger
High precision arbitrary base changer
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/davidfricker/basechanger
Requires
- php: ^5.3.3 || ^7.0
This package is not auto-updated.
Last update: 2025-10-18 01:24:15 UTC
README
Change raw binary bytes to and from an arbitrary base e.g. 36, 58, or 64. This package stands in place of PHP's native base_convert() function and in doing so provides support for arbitrarily large numbers.
Requirements
This package requires the GMP PHP extension to be installed.
Install
Via composer:
composer require davidfricker/basechanger
Usage
use DavidFricker\BaseChanger\GMP; $bytes = openssl_random_pseudo_bytes(32); $base = 64; $base_converted = GMP::changeTo($bytes, $base); $base_reversed = GMP::changeFrom($base_converted, $base);
Licence
This code is released under MIT. Full licence can be found in the licence file.