# hashes.crc32

> A module of hashes's API.

CRC-32 (IEEE 802.3 / zlib / gzip / PNG) — reflected polynomial 0xEDB88320, init/xorout 0xFFFFFFFF. Table-driven with a slice-by-8 fast path.

`crc32(data, seed=0)` reproduces `zlib.crc32(data)` in Python (and, by
extension, gzip/PNG CRCs). Passing a previous result as `seed` chains across
buffers exactly like zlib's `crc32(buf, crc)`:
`crc32(b, seed=crc32(a)) == crc32(a + b)`.

## Structs

### `Crc32`

```mojo
struct Crc32
```

Incremental CRC-32. `seed` is the previous crc32 result (0 to start).

Implements: `Copyable`, `Movable`

#### `__init__`

```mojo
def __init__(out self, seed: UInt32 = UInt32(0))
```

#### `update`

```mojo
def update(mut self, data: Span[UInt8])
```

#### `finish`

```mojo
def finish(self) -> UInt32
```

## Functions

### `crc32`

```mojo
def crc32(data: Span[UInt8], seed: UInt32 = UInt32(0)) -> UInt32
```
