Skip to content

Commit

Permalink
Use Base64 encoding for IRK
Browse files Browse the repository at this point in the history
  • Loading branch information
koenvervloesem committed Oct 30, 2023
1 parent 5fad3f7 commit fe4164e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TheengsGateway/privacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"""
from __future__ import annotations

from base64 import b64decode

from Cryptodome.Cipher import AES

_MSB_MASK = 0b11000000
Expand All @@ -24,7 +26,7 @@ def resolve_private_address(address: str, irk: str) -> bool:

prand = rpa[:3]
hash_value = rpa[3:]
cipher = AES.new(bytes.fromhex(irk), AES.MODE_ECB)
cipher = AES.new(b64decode(irk), AES.MODE_ECB)
localhash = cipher.encrypt(b"\x00" * 13 + prand)

if localhash[13:] != hash_value:
Expand Down

0 comments on commit fe4164e

Please sign in to comment.