Git Product home page Git Product logo

base58's People

Contributors

boppy avatar peter279k avatar tuupola avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

base58's Issues

Usage of GMP

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.

base58/src/Base58.php

Lines 48 to 51 in 9e9cb3b

if (function_exists("gmp_init")) {
$this->encoder = new Base58\GmpEncoder($this->options);
}
$this->encoder = new Base58\PhpEncoder($this->options);

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? ;)

Bitcoin charset

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?

Example Script Doesn't Seem to Work

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"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.