add list_to_int() utility function to convert byte-lists to integers

This commit is contained in:
Harald Welte 2017-08-16 17:20:26 +02:00
parent e786eb1310
commit 6d5127c89a
1 changed files with 4 additions and 0 deletions

View File

@ -65,3 +65,7 @@ def swap_nibbles(array):
for a in array:
rc.append(((a & 0xf0) >> 4) | ((a & 0x0f) << 4))
return rc
# Convert from list of bytes to big-endian integer
def list_to_int(arr):
return int(hexdump(arr), 16)