Skip to content
Snippets Groups Projects
Commit 1f20724d authored by Moul's avatar Moul
Browse files

[mod] #176: Use sha256 from hashlib from stdlib

parent 6a9bc455
No related branches found
No related tags found
1 merge request!149#176: Get rid of PyNaCl and use base58 module
......@@ -16,7 +16,8 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
"""
import re
from nacl import encoding, hash
import hashlib
from nacl import encoding
from silkaj.constants import PUBKEY_PATTERN
from silkaj.tools import message_exit
......@@ -77,9 +78,8 @@ def gen_checksum(pubkey):
Returns the checksum of the input pubkey (encoded in b58)
"""
pubkey_byte = b58_decode(pubkey)
return b58_encode(
hash.sha256(hash.sha256(pubkey_byte, encoding.RawEncoder), encoding.RawEncoder)
)[:3]
hash = hashlib.sha256(hashlib.sha256(pubkey_byte).digest()).digest()
return b58_encode(hash)[:3]
b58_digits = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment