mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-11 06:09:08 -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
|
return private_key_hex, public_key_hex
|
||||||
|
|
||||||
def generate_mac_and_payload(public_key):
|
def generate_mac_and_payload(public_key):
|
||||||
public_key_bytes = public_key.public_numbers().x.to_bytes(28, byteorder='big')
|
key = public_key.public_numbers().x.to_bytes(28, byteorder='big')
|
||||||
mac = public_key_bytes[:6].hex()
|
|
||||||
payload = advertisement_template()
|
addr = bytearray(key[:6])
|
||||||
payload[7:29] = public_key_bytes[6:22]
|
addr[0] |= 0b11000000
|
||||||
return mac, payload.hex()
|
|
||||||
|
adv = advertisement_template()
|
||||||
|
adv[7:29] = key[6:28]
|
||||||
|
adv[29] = key[0] >> 6
|
||||||
|
|
||||||
|
return addr.hex(), adv.hex()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
nkeys = int(input('Enter the number of keys to generate: '))
|
nkeys = int(input('Enter the number of keys to generate: '))
|
||||||
|
|||||||
Reference in New Issue
Block a user