This commit is contained in:
dni ⚡
2023-04-17 08:21:45 +02:00
parent 1ac9d2572d
commit 0af22a6256
4 changed files with 11 additions and 13 deletions
+8 -8
View File
@@ -316,23 +316,23 @@ def _pull_tagged(stream):
# Tagged field containing BitArray
def tagged(char, l):
def tagged(char, bits):
# Tagged fields need to be zero-padded to 5 bits.
while l.len % 5 != 0:
l.append("0b0")
while bits.len % 5 != 0:
bits.append("0b0")
return (
bitstring.pack(
"uint:5, uint:5, uint:5",
CHARSET.find(char),
(l.len / 5) / 32,
(l.len / 5) % 32,
(bits.len / 5) / 32,
(bits.len / 5) % 32,
)
+ l
+ bits
)
def tagged_bytes(char, l):
return tagged(char, bitstring.BitArray(l))
def tagged_bytes(char, bits):
return tagged(char, bitstring.BitArray(bits))
def _trim_to_bytes(barr):