MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / IntegerEncoder

Class IntegerEncoder

pager_lib/pyasn1/codec/ber/encoder.py:166–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164
165
166class IntegerEncoder(AbstractItemEncoder):
167 supportIndefLenMode = False
168 supportCompactZero = False
169
170 def encodeValue(self, value, asn1Spec, encodeFun, **options):
171 if value == 0:
172 if LOG:
173 LOG('encoding %spayload for zero INTEGER' % (
174 self.supportCompactZero and 'no ' or ''
175 ))
176
177 # de-facto way to encode zero
178 if self.supportCompactZero:
179 return (), False, False
180 else:
181 return (0,), False, False
182
183 return to_bytes(int(value), signed=True), False, True
184
185
186class BitStringEncoder(AbstractItemEncoder):

Callers 1

encoder.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected