added basic cryptography, advertising, and forwarding functionality to the LoRa handler. Also added a UUID class for generating unique IDs for each device.
also, i have 2 radios now! :D
This commit is contained in:
16
relay/connection.py
Normal file
16
relay/connection.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from crypt_random import secure_random
|
||||
|
||||
|
||||
|
||||
|
||||
class Connection:
|
||||
def load_public_constants(self):
|
||||
with open("public_constants.txt", "r") as f:
|
||||
self.P = int(f.readline(), 16)
|
||||
self.G = int(f.readline(), 16)
|
||||
|
||||
def __init__(self):
|
||||
self.load_public_constants()
|
||||
|
||||
self.private_key = int.from_bytes(secure_random(1024), "big")
|
||||
self.public_key = pow(self.G, self.private_key) % self.P
|
||||
Reference in New Issue
Block a user