tuupola / base58 Goto Github PK
View Code? Open in Web Editor NEWBase58 encoder and decoder for arbitrary data
License: MIT License
Base58 encoder and decoder for arbitrary data
License: MIT License
Regarding:
This package has both pure PHP and GMP based encoders. By default encoder and decoder will use GMP functions if the extension is installed. If GMP is not available pure PHP encoder will be used instead.
Lines 48 to 51 in 9e9cb3b
I think there is an } else {
missing, resulting in GMP never being used, because it will be set in L51 to its PHP brother.
Am I missing something or should I provide an PR? ;)
Hi
Using the bitcoin charset, it seems to be trimming any preceding 0 byte.
For example:
$bitcoin = new Base58(array("characters"=>Base58::BITCOIN));
$a=$bitcoin->decode('1gbCKFk');
$b=$bitcoin->encode($a);
returns 'gbCKFk'
Is this the expected behaviour?
This looks like a great resource but I can't seem to get it to run!
After installing with composer and trying your test script:
<?php
require __DIR__ . '/vendor/autoload.php';
use RuntimeException;
use Tuupola\Base58;
$base58check = new Base58([
"characters" => Base58::BITCOIN,
"check" => true,
"version" => 0x00
]);
print $base58check->encode("Hello world!"); /* 19wWTEnNTWna86WmtFsTAr5 */
try {
$base58check->decode("19wWTEnNTWna86WmtFsTArX");
} catch (RuntimeException $exception) {
/* Checksum "84fec52c" does not match the expected "84fec512" */
print $exception->getMessage();
}
?>
It seems to fail with the following error:
Warning: The use statement with non-compound name 'RuntimeException' has no effect in test.php on line 3 19wWTEnNTWna86WmtFsTAr5Checksum "84fec52c" does not match the expected "84fec512"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.