diff --git a/pyrad/tests/testPacket.py b/pyrad/tests/testPacket.py index 08c21be..43c110f 100644 --- a/pyrad/tests/testPacket.py +++ b/pyrad/tests/testPacket.py @@ -465,12 +465,8 @@ def setUp(self): def testVerifyChapPasswd(self): chap_id = b'9' chap_challenge = b'987654321' - chap_password = b'%s%s' % (chap_id, md5_constructor( - b'%s%s%s' % ( - chap_id, - b'test_password', - chap_challenge - )).digest()) + chap_password = chap_id + md5_constructor( + chap_id + b'test_password' + chap_challenge).digest() pkt = self.client.CreateAuthPacket( code=packet.AccessChallenge, authenticator=b'ABCDEFG', diff --git a/pyrad/tools.py b/pyrad/tools.py index 9b330b1..8d2b37f 100644 --- a/pyrad/tools.py +++ b/pyrad/tools.py @@ -110,11 +110,10 @@ def EncodeAscendBinary(str): terms[key] = struct.pack('B', int(value)) trailer = 8 * b'\x00' - result = b'%s%s%s\x00%s%s%s%s%s\x00%s%s%s%s\x00\x00%s' % ( + result = b'%s%s%s\x00%s%s%s%s%s\x00%s%s%s%s\x00\x00' % ( terms['family'], terms['action'], terms['direction'], terms['src'], terms['dst'], terms['srcl'], terms['dstl'], terms['proto'], - terms['sport'], terms['dport'], terms['sportq'], terms['dportq'], - trailer) + terms['sport'], terms['dport'], terms['sportq'], terms['dportq']) + trailer return result