Skip to content

Commit e790e19

Browse files
committed
stop using haslib in profit of pycryptodome (also used for AES)
1 parent fc3f522 commit e790e19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/meshcore_cli/meshcore_cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from prompt_toolkit.shortcuts import radiolist_dialog
2525
from prompt_toolkit.completion.word_completer import WordCompleter
2626
from prompt_toolkit.document import Document
27-
from hashlib import sha256
2827
from Crypto.Cipher import AES
2928
from Crypto.Hash import HMAC, SHA256
3029

@@ -1444,7 +1443,7 @@ async def set_channel (mc, chan, name, key=None):
14441443
return None
14451444

14461445
info = res.payload
1447-
info["channel_hash"] = sha256(info["channel_secret"]).digest()[0:1].hex()
1446+
info["channel_hash"] = SHA256.new(info["channel_secret"]).hexdigest()[0:2]
14481447
info["channel_secret"] = info["channel_secret"].hex()
14491448

14501449
if hasattr(mc,'channels') :
@@ -1533,7 +1532,7 @@ async def get_channels (mc, anim=False) :
15331532
if res.type == EventType.ERROR:
15341533
break
15351534
info = res.payload
1536-
info["channel_hash"] = sha256(info["channel_secret"]).digest()[0:1].hex()
1535+
info["channel_hash"] = SHA256.new(info["channel_secret"]).hexdigest()[0:2]
15371536
info["channel_secret"] = info["channel_secret"].hex()
15381537
mc.channels.append(info)
15391538
ch = ch + 1

0 commit comments

Comments
 (0)