Base58 Encode and Decode using PHP with example; base58_encode(), base58_decode()

Reply to comment

Regarding first comment:


base58_encode('74') => 2h

I do not see how this can be true. Why neglect the "1"?

base58_encode('74') should be 1h, no?


I tried very hard wrapping my head around this one as I couldn't get WHY it was not working that way.

Up to the point that I was almost reinventing the wheel by writing my own routine with the same alphabet, and is was then and there that I finally realized: I made a parallel with the alphabet "0123456789"... when you're counting up to "9", you don't really expect to have "00" next, rather you have "10", as "9" is actually "09". Well, base58 has no "0", so guess what, it's "1" that takes the value of 0 in that alphabet. BAM everything makes sense now.

Thanks brain.