Post
Topic
Board Bitcoin Technical Support
Re: Private Key to WIF?
by
brovine
on 18/11/2013, 21:42:22 UTC
As you exit this loop:

Code:
while (gmp_strval($divmod[0]) >= 58)
{
$divmod = divmod($divmod[0], 58);
$out = $alphabet[gmp_strval($divmod[1])] . $out;
}

$divmod[0] = 4

But you never use that value.  You exit the loop and print out the conversion that you've done so far, but you never calculate the final $alphabet[gmp_strval($divmod[0])]

Oh you're right. I don't understand why, though?

I'm porting it from https://github.com/bkkcoins/misc/blob/master/hexwif/hexwif

and it's pretty much the exact same code, isn't it?

Either way, thanks a lot!