mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
remove some whitespace to allow for easier debugging
This commit is contained in:
parent
1f89843122
commit
c2f7a63f97
1 changed files with 0 additions and 4 deletions
|
|
@ -188,17 +188,14 @@ Reverse the order of bits in a word that is bitwidth bits wide
|
||||||
def bitflip(data_block, bitwidth=32):
|
def bitflip(data_block, bitwidth=32):
|
||||||
if bitwidth == 0:
|
if bitwidth == 0:
|
||||||
return data_block
|
return data_block
|
||||||
|
|
||||||
bytewidth = bitwidth // 8
|
bytewidth = bitwidth // 8
|
||||||
bitswapped = bytearray()
|
bitswapped = bytearray()
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(data_block):
|
while i < len(data_block):
|
||||||
data = int.from_bytes(data_block[i:i+bytewidth], byteorder='big', signed=False)
|
data = int.from_bytes(data_block[i:i+bytewidth], byteorder='big', signed=False)
|
||||||
b = '{:0{width}b}'.format(data, width=bitwidth)
|
b = '{:0{width}b}'.format(data, width=bitwidth)
|
||||||
bitswapped.extend(int(b[::-1], 2).to_bytes(bytewidth, byteorder='big'))
|
bitswapped.extend(int(b[::-1], 2).to_bytes(bytewidth, byteorder='big'))
|
||||||
i = i + bytewidth
|
i = i + bytewidth
|
||||||
|
|
||||||
return bytes(bitswapped)
|
return bytes(bitswapped)
|
||||||
|
|
||||||
# assumes a, b are the same length eh?
|
# assumes a, b are the same length eh?
|
||||||
|
|
@ -282,7 +279,6 @@ def try_key_to_bytes(input):
|
||||||
key_bytes = Bip39MnemonicDecoder().Decode(input)
|
key_bytes = Bip39MnemonicDecoder().Decode(input)
|
||||||
else:
|
else:
|
||||||
key_bytes = int(input, 16).to_bytes(32, byteorder='big')
|
key_bytes = int(input, 16).to_bytes(32, byteorder='big')
|
||||||
|
|
||||||
return key_bytes
|
return key_bytes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue