MCPcopy Create free account
hub / github.com/ccxt/ccxt / encode_length

Function encode_length

python/ccxt/static_dependencies/ecdsa/der.py:143–152  ·  view source on GitHub ↗
(l)

Source from the content-addressed store, hash-verified

141
142
143def encode_length(l):
144 assert l >= 0
145 if l < 0x80:
146 return int.to_bytes(l, 1, 'big')
147 s = ("%x" % l).encode()
148 if len(s) % 2:
149 s = b'0' + s
150 s = binascii.unhexlify(s)
151 llen = len(s)
152 return int.to_bytes(0x80 | llen, 1, 'big') + s
153
154
155def read_length(string):

Callers 5

encode_constructedFunction · 0.85
encode_bitstringFunction · 0.85
encode_octet_stringFunction · 0.85
encode_oidFunction · 0.85
encode_sequenceFunction · 0.85

Calls 2

to_bytesMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…