From 8fba4bba40daa755dbec172e3d46aef5b9d8f93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dudek?= Date: Fri, 10 Mar 2023 01:40:37 +0100 Subject: [PATCH] Fixing readme for Python3 and adding requirements --- README.md | 2 +- lutil/crypto.py | 1 + requirements.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/README.md b/README.md index 0b50f2a..c0cdcdc 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ As an example, to check if the key `000102030405060708090A0B0C0D0E0F` is used to >>> pkt = LoRa(binascii.unhexlify(p)) >>> pkt ] MIC=0x53024c49 |> ->>> checkMIC(binascii.unhexlify(key), str(pkt)) +>>> checkMIC(binascii.unhexlify(key), bytes(pkt)) True ``` diff --git a/lutil/crypto.py b/lutil/crypto.py index 85f99f1..5f08d40 100644 --- a/lutil/crypto.py +++ b/lutil/crypto.py @@ -63,6 +63,7 @@ def checkMIC(key, hexpkt, direction=1): except Exception: mic = binascii.hexlify(mic) cmic = bytes(getPHY_CMAC(key, hexpkt), 'utf-8') + print (repr(mic), repr(cmic)) return (mic == cmic) # TODO: more helpers diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..92b7a89 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pycryptodome +scapy