mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 18:18:35 -07:00
FindMy: Fix key generation script
This commit is contained in:
@@ -23,11 +23,16 @@ def convert_key_to_hex(private_key, public_key):
|
||||
return private_key_hex, public_key_hex
|
||||
|
||||
def generate_mac_and_payload(public_key):
|
||||
public_key_bytes = public_key.public_numbers().x.to_bytes(28, byteorder='big')
|
||||
mac = public_key_bytes[:6].hex()
|
||||
payload = advertisement_template()
|
||||
payload[7:29] = public_key_bytes[6:22]
|
||||
return mac, payload.hex()
|
||||
key = public_key.public_numbers().x.to_bytes(28, byteorder='big')
|
||||
|
||||
addr = bytearray(key[:6])
|
||||
addr[0] |= 0b11000000
|
||||
|
||||
adv = advertisement_template()
|
||||
adv[7:29] = key[6:28]
|
||||
adv[29] = key[0] >> 6
|
||||
|
||||
return addr.hex(), adv.hex()
|
||||
|
||||
def main():
|
||||
nkeys = int(input('Enter the number of keys to generate: '))
|
||||
|
||||
Reference in New Issue
Block a user