"""CRC32 helpers for LibreVNA packet framing."""

from __future__ import annotations

import zlib


def crc32(data: bytes | bytearray | memoryview) -> int:
    """Compute protocol CRC32 over packet bytes excluding trailing CRC field."""
    return zlib.crc32(data) & 0xFFFFFFFF
