Fix underflow that results in infinite loop in b58enc.

Fixes issue #1.