Improve base58 encoding performace by reducing useless iteration

In populating the b58 vector, don't need to go through the whole vector but just those valid bytes.

Signed-off-by: Huang Le <4tarhl@gmail.com>