base58: add paranoid return value checks

Always clear buffers and check return values.

If there is a function with an out parameter, checking that result in the same if() clause can be harder to read. Of course the || evaluation order makes sure that this is correct, but I prefer logical conditions that don't depend on the order, and thus don't break when they are rearranged .