MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / b16decode

Function b16decode

tools/python-3.11.9-amd64/Lib/base64.py:278–293  ·  view source on GitHub ↗

Decode the Base16 encoded bytes-like object or ASCII string s. Optional casefold is a flag specifying whether a lowercase alphabet is acceptable as input. For security purposes, the default is False. The result is returned as a bytes object. A binascii.Error is raised if s

(s, casefold=False)

Source from the content-addressed store, hash-verified

276
277
278def b16decode(s, casefold=False):
279 """Decode the Base16 encoded bytes-like object or ASCII string s.
280
281 Optional casefold is a flag specifying whether a lowercase alphabet is
282 acceptable as input. For security purposes, the default is False.
283
284 The result is returned as a bytes object. A binascii.Error is raised if
285 s is incorrectly padded or if there are non-alphabet characters present
286 in the input.
287 """
288 s = _bytes_from_decode_data(s)
289 if casefold:
290 s = s.upper()
291 if re.search(b'[^0-9A-F]', s):
292 raise binascii.Error('Non-base16 digit found')
293 return binascii.unhexlify(s)
294
295#
296# Ascii85 encoding/decoding

Callers

nothing calls this directly

Calls 3

_bytes_from_decode_dataFunction · 0.85
upperMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected