base58: add paranoid return value checks

Always clear buffers and check return values.

Oh, not a comment on performance. I just find it more readable to write it in the condition directly. Just nitpicking, feel free to ignore.