OpenSSL-independent implementation of base58