Sebastian Thielrefactor45010861 year agoHistory
23 lines · 833 B · Rust
RawDownload
//! Hash functions and hash utilities /// Compute a CRC32 hash from the given `bytes`, returning the CRC32 hash.////// When calling this function for the first time, `previous_value` should be `0`./// Otherwise, it should be the previous return value of this function to provide a hash/// of multiple sequential chunks of `bytes`.#[cfg(feature = "crc32")]pub fn crc32_update(previous_value: u32, bytes: &[u8]) -> u32 {    let mut h = crc32fast::Hasher::new_with_initial(previous_value);    h.update(bytes);    h.finalize()} /// Compute a CRC32 value of the given input `bytes`.////// In case multiple chunks of `bytes` are present, one should use [`crc32_update()`] instead.#[cfg(feature = "crc32")]pub fn crc32(bytes: &[u8]) -> u32 {    let mut h = crc32fast::Hasher::new();    h.update(bytes);    h.finalize()}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t