1
1
# crc32fast [ ![ Build Status] [ travis-img ]] [ travis ] [ ![ Crates.io] [ crates-img ]] [ crates ] [ ![ Documentation] [ docs-img ]] [ docs ]
2
2
3
- [ travis-img ] : https://travis-ci.com/srijs/rust-crc32fast.svg?branch=master
4
- [ travis ] : https://travis-ci.com/srijs/rust-crc32fast
5
- [ crates-img ] : https://img.shields.io/crates/v/crc32fast.svg
6
- [ crates ] : https://crates.io/crates/crc32fast
7
- [ docs-img ] : https://docs.rs/crc32fast/badge.svg
8
- [ docs ] : https://docs.rs/crc32fast
3
+ [ travis-img ] : https://travis-ci.com/srijs/rust-crc32fast.svg?branch=master
4
+ [ travis ] : https://travis-ci.com/srijs/rust-crc32fast
5
+ [ crates-img ] : https://img.shields.io/crates/v/crc32fast.svg
6
+ [ crates ] : https://crates.io/crates/crc32fast
7
+ [ docs-img ] : https://docs.rs/crc32fast/badge.svg
8
+ [ docs ] : https://docs.rs/crc32fast
9
9
10
10
_ Fast, SIMD-accelerated CRC32 (IEEE) checksum computation_
11
11
12
12
## Usage
13
13
14
+ ### Simple usage
15
+
16
+ For simple use-cases, you can call the ` hash ` convenience function to
17
+ directly compute the CRC32 checksum for a given byte slice:
18
+
14
19
``` rust
15
- extern crate crc32fast;
20
+ let checksum = crc32fast :: hash (b " foo bar baz" );
21
+ ```
16
22
23
+ ### Advanced usage
24
+
25
+ For use-cases that require more flexibility or performance, for example when
26
+ processing large amounts of data, you can create and manipulate a ` Hasher ` :
27
+
28
+ ``` rust
17
29
use crc32fast :: Hasher ;
18
30
19
31
let mut hasher = Hasher :: new ();
@@ -33,10 +45,10 @@ Calling the `Hasher::new` constructor at runtime will perform a feature detectio
33
45
optimal implementation for the current CPU feature set.
34
46
35
47
| crate | version | variant | ns/iter | MB/s |
36
- | ------------------------------------- | --------- | ----------- | --------- | ------ |
37
- | [ crc] ( https://crates.io/crates/crc ) | 1.8.1 | n/a | 4,926 | 207 |
38
- | crc32fast (this crate) | 1.0.0 | baseline | 683 | 1499 |
39
- | crc32fast (this crate) | 1.0.0 | pclmulqdq | 140 | 7314 |
48
+ | ----------------------------------- | ------- | --------- | ------- | ---- |
49
+ | [ crc] ( https://crates.io/crates/crc ) | 1.8.1 | n/a | 4,926 | 207 |
50
+ | crc32fast (this crate) | 1.0.0 | baseline | 683 | 1499 |
51
+ | crc32fast (this crate) | 1.0.0 | pclmulqdq | 140 | 7314 |
40
52
41
53
## Memory Safety
42
54
@@ -67,10 +79,10 @@ Currently, enabling this feature flag will make the optimized `aarch64` implemen
67
79
68
80
This project is licensed under either of
69
81
70
- * Apache License, Version 2.0, ([ LICENSE-APACHE] ( LICENSE-APACHE ) or
71
- http://www.apache.org/licenses/LICENSE-2.0 )
72
- * MIT license ([ LICENSE-MIT] ( LICENSE-MIT ) or
73
- http://opensource.org/licenses/MIT )
82
+ - Apache License, Version 2.0, ([ LICENSE-APACHE] ( LICENSE-APACHE ) or
83
+ http://www.apache.org/licenses/LICENSE-2.0 )
84
+ - MIT license ([ LICENSE-MIT] ( LICENSE-MIT ) or
85
+ http://opensource.org/licenses/MIT )
74
86
75
87
at your option.
76
88
0 commit comments