# Crate crc [−] [src]

# crc

Rust implementation of CRC(32, 64)

## Usage

### Compute CRC32

    use crc::{crc32, Hasher32};

    // CRC-32-IEEE being the most commonly used one
    assert_eq!(crc32::checksum_ieee(b"123456789"), 0xcbf43926);
    assert_eq!(crc32::checksum_castagnoli(b"123456789"), 0xe3069283);
    assert_eq!(crc32::checksum_koopman(b"123456789"), 0x2d3dd0ae);

    // use provided or custom polynomial
    let mut digest = crc32::Digest::new(crc32::IEEE);
    digest.write(b"123456789");
    assert_eq!(digest.sum32(), 0xcbf43926);

    // with initial
    let mut digest = crc32::Digest::new_with_initial(crc32::IEEE, 0u32);
    digest.write(b"123456789");
    assert_eq!(digest.sum32(), 0xcbf43926);

### Compute CRC64

    use crc::{crc64, Hasher64};

    assert_eq!(crc64::checksum_ecma(b"123456789"), 0x995dc9bbdf1939fa);
    assert_eq!(crc64::checksum_iso(b"123456789"), 0xb90956c775a41001);

    // use provided or custom polynomial
    let mut digest = crc64::Digest::new(crc64::ECMA);
    digest.write(b"123456789");
    assert_eq!(digest.sum64(), 0x995dc9bbdf1939fa);

    // with initial
    let mut digest = crc64::Digest::new_with_initial(crc64::ECMA, 0u64);
    digest.write(b"123456789");
    assert_eq!(digest.sum64(), 0x995dc9bbdf1939fa);

## Reexports

`pub use self::crc32::Hasher32;`
`pub use self::crc64::Hasher64;`

## Modules

crc32 |
crc64 |

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)