INNER CODE UNIT · Python

capture

varunsalian/debrify · tool/webdav_memory_stress/run.py:57

def capture(*args):
    return command(*args, stdout=subprocess.PIPE).stdout


def input_fingerprint(context=None):
    """Hash each file once; a build context is the authoritative copied input."""
    digest = hashlib.sha256()
    inputs = [(str((HERE / name).relative_to(ROOT)), name) for name in BUILD_FILES]
    inputs += [(f"lib/{name}", f"lib/{name}") for name in SOURCES]
    hashes = {}
    for repository_name, context_name in inputs:
        path = ROOT / repository_name if context is None else context / context_name
        contents = path.read_bytes()
        digest.update(repository_name.encode())
        digest.update(b"\0")
        digest.update(contents)
        digest.update(b"\0")
        hashes[repository_name] = hashlib.sha256(contents).hexdigest()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…