Last active
October 7, 2015 19:18
-
-
Save noodlehaus/3212985 to your computer and use it in GitHub Desktop.
[php] base conversion utilities (b58, dec, hex)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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