Documentation

QedShare.Encoding.Crc32

CRC-32 #

The standard CRC-32 (IEEE 802.3, reflected polynomial 0xEDB88320), as used by zip and PNG.

It is used only to detect accidents (typos, truncation, mixing up shares), never as a security check: anyone can recompute it (see README: Threat model).

The implementation is bitwise and branch-free (the conditional XOR uses a mask). That matters because the secret's integrity tag is a CRC of secret data. A lookup table indexed by secret bytes could leak them through cache timing.

The reflected CRC-32 polynomial.

Equations
Instances For
    @[inline]

    One bit step: shift right, and XOR in the polynomial if the bit shifted out was 1. Branch-free: 0 - (crc &&& 1) is all ones or all zeros.

    Equations
    Instances For

      Feed one byte into the running CRC state (8 bit steps).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        CRC-32 of a list of bytes.

        Equations
        Instances For

          The four bytes of a UInt32, most significant first.

          Equations
          Instances For