#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
from argparse import ArgumentParser from pathlib import Path from struct import calcsize, unpack
def bytes_to_hex_literal(data): # data is bytes # yields hex formatted strings like "0xFF" # this can be simplified in 3.8+ using bytes.hex(sep=",").split(",")
hexified = iter(data.hex().upper())
# see grouper in itertools recipes for result in zip(hexified, hexified): yield f"0x{''.join(result)}"
def unpack_fp(fmt, fp): # fmt is a struct format string # fp is an open file handle # returns tuple as per struct.unpack(fmt, ...)
size = calcsize(fmt) return unpack(fmt, fp.read(size))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.