mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
tests/krb5: Make ‘keybytes’ a bytes object rather than a list
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
69db1b5888
commit
a0d32a3980
@ -279,9 +279,9 @@ class _DES3CBC(_SimplifiedEnctype):
|
|||||||
b &= ~1
|
b &= ~1
|
||||||
return b if bin(b & ~1).count('1') % 2 else b | 1
|
return b if bin(b & ~1).count('1') % 2 else b | 1
|
||||||
assert len(seed) == 7
|
assert len(seed) == 7
|
||||||
firstbytes = [parity(b & ~1) for b in seed]
|
firstbytes = bytes(parity(b & ~1) for b in seed)
|
||||||
lastbyte = parity(sum((seed[i] & 1) << i + 1 for i in range(7)))
|
lastbyte = parity(sum((seed[i] & 1) << i + 1 for i in range(7)))
|
||||||
keybytes = bytes([b for b in firstbytes + [lastbyte]])
|
keybytes = firstbytes + bytes([lastbyte])
|
||||||
if _is_weak_des_key(keybytes):
|
if _is_weak_des_key(keybytes):
|
||||||
keybytes[7] = bytes([keybytes[7] ^ 0xF0])
|
keybytes[7] = bytes([keybytes[7] ^ 0xF0])
|
||||||
return keybytes
|
return keybytes
|
||||||
|
Loading…
Reference in New Issue
Block a user