Skip to content

Instantly share code, notes, and snippets.

@noodlehaus
Last active October 7, 2015 19:18
Show Gist options
  • Save noodlehaus/3212985 to your computer and use it in GitHub Desktop.
Save noodlehaus/3212985 to your computer and use it in GitHub Desktop.
[php] base conversion utilities (b58, dec, hex)
<?php
function b58_to_dec($val) {
return gmp_strval(gmp_init((string) $val, 58), 10);
}
function b58_to_hex($val) {
return gmp_strval(gmp_init((string) $val, 58), 16);
}
function dec_to_b58($val) {
return gmp_strval(gmp_init((string) $val, 10), 58);
}
function hex_to_b58($val) {
return gmp_strval(gmp_init((string) $val, 16), 58);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment