MCPcopy Create free account
hub / github.com/secdev/scapy / huffman_conv2bitstring

Method huffman_conv2bitstring

scapy/contrib/http2.py:1132–1150  ·  view source on GitHub ↗

huffman_conv2bitstring converts a string into its bitstring representation. It returns a tuple: the bitstring and its bitlength. This function DOES NOT compress/decompress the string! :param str s: the bytestring to convert. :return: (int, int): the bitstring of s,

(cls, s)

Source from the content-addressed store, hash-verified

1130
1131 @classmethod
1132 def huffman_conv2bitstring(cls, s):
1133 # type: (str) -> Tuple[int, int]
1134 """ huffman_conv2bitstring converts a string into its bitstring
1135 representation. It returns a tuple: the bitstring and its bitlength.
1136 This function DOES NOT compress/decompress the string!
1137
1138 :param str s: the bytestring to convert.
1139 :return: (int, int): the bitstring of s, and its bitlength.
1140 :raises: AssertionError
1141 """
1142 i = 0
1143 ibl = len(s) * 8
1144 for c in s:
1145 i = (i << 8) + orb(c)
1146
1147 ret = i, ibl
1148 assert ret[0] >= 0
1149 assert ret[1] >= 0
1150 return ret
1151
1152 @classmethod
1153 def huffman_compute_decode_tree(cls):

Callers 1

_parseMethod · 0.80

Calls 1

orbFunction · 0.90

Tested by

no test coverage detected