mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 13:40:19 +00:00
Optimised announces to 151 bytes
This commit is contained in:
parent
9c995b33dd
commit
db527b6759
@ -156,10 +156,7 @@ class Destination:
|
|||||||
|
|
||||||
signature = self.identity.sign(signed_data)
|
signature = self.identity.sign(signed_data)
|
||||||
|
|
||||||
# TODO: Check if this could be optimised by only
|
announce_data = self.identity.get_public_key()+random_hash+signature
|
||||||
# carrying the hash in the destination field, not
|
|
||||||
# also redundantly inside the signed blob as here
|
|
||||||
announce_data = self.hash+self.identity.get_public_key()+random_hash+signature
|
|
||||||
|
|
||||||
if app_data != None:
|
if app_data != None:
|
||||||
announce_data += app_data
|
announce_data += app_data
|
||||||
|
@ -149,16 +149,16 @@ class Identity:
|
|||||||
if packet.packet_type == RNS.Packet.ANNOUNCE:
|
if packet.packet_type == RNS.Packet.ANNOUNCE:
|
||||||
RNS.log("Validating announce from "+RNS.prettyhexrep(packet.destination_hash), RNS.LOG_DEBUG)
|
RNS.log("Validating announce from "+RNS.prettyhexrep(packet.destination_hash), RNS.LOG_DEBUG)
|
||||||
destination_hash = packet.destination_hash
|
destination_hash = packet.destination_hash
|
||||||
public_key = packet.data[10:Identity.KEYSIZE//8+10]
|
public_key = packet.data[:Identity.KEYSIZE//8]
|
||||||
random_hash = packet.data[Identity.KEYSIZE//8+10:Identity.KEYSIZE//8+20]
|
random_hash = packet.data[Identity.KEYSIZE//8:Identity.KEYSIZE//8+10]
|
||||||
signature = packet.data[Identity.KEYSIZE//8+20:Identity.KEYSIZE//8+20+Identity.KEYSIZE//8]
|
signature = packet.data[Identity.KEYSIZE//8+10:Identity.KEYSIZE//8+10+Identity.KEYSIZE//8]
|
||||||
app_data = b""
|
app_data = b""
|
||||||
if len(packet.data) > Identity.KEYSIZE//8+20+Identity.KEYSIZE//8:
|
if len(packet.data) > Identity.KEYSIZE//8+10+Identity.KEYSIZE//8:
|
||||||
app_data = packet.data[Identity.KEYSIZE//8+20+Identity.KEYSIZE//8:]
|
app_data = packet.data[Identity.KEYSIZE//8+10+Identity.KEYSIZE//8:]
|
||||||
|
|
||||||
signed_data = destination_hash+public_key+random_hash+app_data
|
signed_data = destination_hash+public_key+random_hash+app_data
|
||||||
|
|
||||||
if not len(packet.data) > Identity.KEYSIZE//8+20+Identity.KEYSIZE//8:
|
if not len(packet.data) > Identity.KEYSIZE//8+10+Identity.KEYSIZE//8:
|
||||||
app_data = None
|
app_data = None
|
||||||
|
|
||||||
announced_identity = Identity(create_keys=False)
|
announced_identity = Identity(create_keys=False)
|
||||||
|
@ -186,6 +186,7 @@ class Packet:
|
|||||||
self.packed = True
|
self.packed = True
|
||||||
self.update_hash()
|
self.update_hash()
|
||||||
|
|
||||||
|
|
||||||
def unpack(self):
|
def unpack(self):
|
||||||
self.flags = self.raw[0]
|
self.flags = self.raw[0]
|
||||||
self.hops = self.raw[1]
|
self.hops = self.raw[1]
|
||||||
|
@ -672,8 +672,8 @@ Binary Packet Format
|
|||||||
wire size including all fields.
|
wire size including all fields.
|
||||||
|
|
||||||
- Path Request : 33 bytes
|
- Path Request : 33 bytes
|
||||||
- Announce : 323 bytes
|
- Announce : 151 bytes
|
||||||
- Link Request : 141 bytes
|
- Link Request : 182 bytes
|
||||||
- Link Proof : 205 bytes
|
- Link Proof : 205 bytes
|
||||||
- Link RTT packet : 86 bytes
|
- Link RTT packet : 86 bytes
|
||||||
- Link keepalive : 14 bytes
|
- Link keepalive : 14 bytes
|
Loading…
Reference in New Issue
Block a user