Pip install hashlib

здравствуйте не могу установить hashlib на python 3.8.6 пишет ошибку Подготовка метаданных (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info не запустился успешно.

Please write in English.

Hashlib has been part of the standard library since python2.5, released in 2006. You don’t need to install it from pypi.

Hello, thanks for the answer, that is, I need to use a Python versi lower than Python 3.8.6,? Please advise how to fix this error. raise ValueError(‘“{}” is an invalid base58 encoded character.’.format(char)) from None
ValueError: “” is an invalid base58 encoded character.

No, you should not downgrade your python version.

Please post the code that causes this error, along with the full stack trace.

1 Like

from collections import deque

from bit.crypto import double_sha256_checksum
from bit.utils import int_to_unknown_bytes

BASE58_ALPHABET = ‘123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz’
BASE58_ALPHABET_LIST = list(BASE58_ALPHABET)
BASE58_ALPHABET_INDEX = {char: index for index, char in enumerate(BASE58_ALPHABET)}

def b58encode(bytestr):

alphabet = BASE58_ALPHABET_LIST

encoded = deque()
append = encoded.appendleft
_divmod = divmod

num = int.from_bytes(bytestr, 'big')

while num > 0:
    num, rem = _divmod(num, 58)
    append(alphabet[rem])

encoded = ''.join(encoded)

pad = 0
for byte in bytestr:
    if byte == 0:
        pad += 1
    else:
        break

return '1' * pad + encoded

def b58encode_check(bytestr):
return b58encode(bytestr + double_sha256_checksum(bytestr))

def b58decode(string):

alphabet_index = BASE58_ALPHABET_INDEX

num = 0

try:
    for char in string:
        num *= 58
        num += alphabet_index[char]
except KeyError:
    raise ValueError('"{}" is an invalid base58 encoded character.'.format(char)) from None

bytestr = int_to_unknown_bytes(num)

pad = 0
for char in string:
    if char == '1':
        pad += 1
    else:
        break

return b'\x00' * pad + bytestr

def b58decode_check(string):

decoded = b58decode(string)
shortened = decoded[:-4]
decoded_checksum = decoded[-4:]
hash_checksum = double_sha256_checksum(shortened)

if decoded_checksum != hash_checksum:
    raise ValueError(
        'Decoded checksum {} derived from "{}" is not equal to hash '
        'checksum {}.'.format(decoded_checksum, string, hash_checksum)
    )

return shortened

That’s the base58 module from a package called bit, apparently.

We need to see your own code.