MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / bin_to_num

Function bin_to_num

src/commoncode/codec.py:39–43  ·  view source on GitHub ↗

Convert a big endian byte-ordered binary string to an integer or long.

(binstr)

Source from the content-addressed store, hash-verified

37
38
39def bin_to_num(binstr):
40 """
41 Convert a big endian byte-ordered binary string to an integer or long.
42 """
43 return int.from_bytes(binstr, byteorder="big", signed=False)
44
45
46def urlsafe_b64encode(s):

Calls

no outgoing calls