Go to file
natalie 3b5b17e7ac
Merge pull request #1 from ZcashFoundation/no-std
add no_std support
2024-02-16 15:55:28 +00:00
src add no_std support 2024-01-10 16:43:30 -03:00
.gitignore initial commit 2022-10-05 12:46:04 -04:00
Cargo.toml add no_std support 2024-01-10 16:43:30 -03:00
LICENSE initial commit 2022-10-05 12:46:04 -04:00
README.md remove const_eval_limit increase except for cfg(test), which needs it 2022-11-02 02:46:59 -04:00

README.md

const-crc32

A const fn crc32 checksum implementation.

Examples

const BYTES: &[u8] = "The quick brown fox jumps over the lazy dog".as_bytes();
const CKSUM: u32 = const_crc32::crc32(BYTES);
assert_eq!(CKSUM, 0x414fa339_u32);

Usage

This is a naive implementation that should be expected to have poor performance if used on dynamic data at runtime. Usage should generally be restricted to declaring const variables based on static or const data available at build time.

#[const_eval_limit]

You may need to increase the crate-wide const_eval_limit setting to use const_crc32 for larger byte slices.

Increating const_eval_limit requires the nightly-only #![feature(const_eval_limit)].

Previously, this crate set the limit itself, however, as of the 2022-10-30 nightly, the value set in const_crc32 does not increase the limit for crates which use the library.

Compile time for const data around 100k is less than 1s.