From 1d7b3eb6bad677fc5dc44a868b7a746137ca8337 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 10 Jan 2022 00:44:30 +0000 Subject: [PATCH] add nanosecond times to packet before hashing to make sure every single packet is unique --- bridge_master.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 7bce9f0..118e620 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -34,7 +34,7 @@ This program currently only works with group voice calls. # Python modules we need import sys from bitarray import bitarray -from time import time,sleep,perf_counter +from time import time,sleep,perf_counter,time_ns import importlib.util import re import copy @@ -1469,7 +1469,9 @@ class routerOBP(OPENBRIDGE): #pkt_crc = Crc32.calc(_data[4:53]) #_pkt_crc = Crc32.calc(dmrpkt) - _pkt_crc = _hash + #_pkt_crc = _hash + _time_b = bytes(str(pkt_time),'utf8') + _pkt_crc = sha1(_data + _time_b).digest() # Match UNIT data, SMS/GPS, and send it to the dst_id if it is in SUB_MAP if _call_type == 'unit' and (_dtype_vseq == 6 or _dtype_vseq == 7 or _dtype_vseq == 8 or ((_stream_id not in self.STATUS) and _dtype_vseq == 3)): @@ -2063,9 +2065,9 @@ class routerHBP(HBSYSTEM): dmrpkt = _data[20:53] _bits = _data[15] - #_pkt_crc = Crc32.calc(_data[4:53]) - _pkt_crc = sha1(_data).digest() - + _time_b = bytes(str(time_ns()),'utf8') + _pkt_crc = sha1(_data + _time_b).digest() + _nine = bytes_3(9) _lang = CONFIG['SYSTEMS'][self._system]['ANNOUNCEMENT_LANGUAGE']