ECDSA не могу подписать сообщение - Python
Формулировка задачи:
Всем привет, затык в ecdsa
print(privat_key)
bd25620fe024006abe4fcedf6e62a9dda2844126c516c8ec37e00797bc384130
C:\Users\Egor\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/Egor/PycharmProjects/untitled/main.py
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
[2018-04-04 02:32:44,242] ERROR in app: Exception on /openwallet [POST]
Traceback (most recent call last):
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:/Users/Egor/PycharmProjects/untitled/main.py", line 79, in open_and_varify_file
return send_atom(file_bytes)
File "C:/Users/Egor/PycharmProjects/untitled/main.py", line 128, in send_atom
msg['sign'] = wallet.generate_sig(file_bytes['privatkey_clear'],str(msg))
File "C:\Users\Egor\PycharmProjects\untitled\wallet.py", line 73, in generate_sig
sign_msg = private_key.sign(msg).encode('utf-8')
File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\ecdsa\keys.py", line 254, in sign
h = hashfunc(data).digest()
TypeError: Unicode-objects must be encoded before hashing
127.0.0.1 - - [04/Apr/2018 02:32:44] "POST /openwallet HTTP/1.1" 500 -
Решение задачи: «ECDSA не могу подписать сообщение»
textual
Листинг программы
File "C:\Users\Egor\PycharmProjects\untitled\wallet.py", line 73, in generate_sig sign_msg = private_key.sign(msg).encode('utf-8') File "C:\Users\Egor\PycharmProjects\untitled\venv\lib\site-packages\ecdsa\keys.py", line 254, in sign h = hashfunc(data).digest() TypeError: Unicode-objects must be encoded before hashing
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д