From dcb7b5c3951e45414521b4805bdcd36bba9de105 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Thu, 21 Jul 2016 19:06:04 -0500 Subject: [PATCH] SHA256 Not Accepted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …duplicates output example in the document, but the master won’t accept it. --- hblink.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hblink.py b/hblink.py index a9d5e20..0e26d49 100755 --- a/hblink.py +++ b/hblink.py @@ -15,6 +15,7 @@ import os # Specifig functions from modules we need from binascii import b2a_hex as h +from binascii import a2b_hex as a from socket import gethostbyname from random import randint from hashlib import sha256 @@ -124,10 +125,11 @@ class HBCLIENT(DatagramProtocol): print('DMRD Received') elif _command == 'MSTN': # Actually MSTNAK -- a NACK from the master print('MSTNAC Received') - elif _command == 'RPTA': # Actually MSTACK -- an ACK from the master - _login_int32 = _data[6:11] + elif _command == 'RPTA': # Actually RPTACK -- an ACK from the master + _login_int32 = _data[6:10] logger.info('(%s) Repeater Login ACK Received with 32bit ID: %s', self._client, h(_login_int32)) - self.send_packet('RPTK'+self._config['RADIO_ID']+sha256(h(_login_int32).upper()+self._config['PASSPHRASE']).hexdigest()) + _pass_hash = a(sha256(h(_login_int32).upper()+self._config['PASSPHRASE']).hexdigest()) + self.send_packet('RPTK'+self._config['RADIO_ID']+_pass_hash) elif _command == 'RPTP': # Actually RPTPONG -- a reply to MSTPING (send by client) print('RPTPONG Received') elif _command == 'MSTC': # Actually MSTCL -- notify the master this client is closing