fastcrc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '0772494d0d2c8fa808b0f62ba7487b13e723e75d916e5307d3274bbf01449ac0'
4
+ data.tar.gz: 5d6129ac6a077239ae5aca6a318e08f5edba866cde26fbb474576b5ee01889ea
5
+ SHA512:
6
+ metadata.gz: af5f7bca3e62ceb11011a26b432d378a500c980750ebbe5dc30a0648942180f9e4d6e1844de5a80d33c8b07f4a6e8dbf9ad0abe2287617dc82e3f0d5bf64ecb1
7
+ data.tar.gz: 6f06e6ea98960cfd18a0f8a42b918b53101e063a937781d9e961f6dd576d4cf791e88957479ac80728e9a8e5a673998544587c301508e2e4f3a5040a366b53bd
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2026-06-23
4
+
5
+ - Initial release
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "fastcrc" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["dsh0416@gmail.com"](mailto:"dsh0416@gmail.com").
data/Cargo.lock ADDED
@@ -0,0 +1,339 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.4"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.72.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "proc-macro2",
25
+ "quote",
26
+ "regex",
27
+ "rustc-hash",
28
+ "shlex",
29
+ "syn",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "bitflags"
34
+ version = "2.13.0"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
37
+
38
+ [[package]]
39
+ name = "cexpr"
40
+ version = "0.6.0"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
43
+ dependencies = [
44
+ "nom",
45
+ ]
46
+
47
+ [[package]]
48
+ name = "cfg-if"
49
+ version = "1.0.4"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
52
+
53
+ [[package]]
54
+ name = "clang-sys"
55
+ version = "1.8.1"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
58
+ dependencies = [
59
+ "glob",
60
+ "libc",
61
+ "libloading",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "crc-fast"
66
+ version = "1.10.0"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "e75b2483e97a5a7da73ac68a05b629f9c53cff58d8ed1c77866079e18b00dba5"
69
+ dependencies = [
70
+ "digest",
71
+ "spin",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "crypto-common"
76
+ version = "0.1.7"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
79
+ dependencies = [
80
+ "generic-array",
81
+ "typenum",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "digest"
86
+ version = "0.10.7"
87
+ source = "registry+https://github.com/rust-lang/crates.io-index"
88
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
89
+ dependencies = [
90
+ "crypto-common",
91
+ ]
92
+
93
+ [[package]]
94
+ name = "either"
95
+ version = "1.16.0"
96
+ source = "registry+https://github.com/rust-lang/crates.io-index"
97
+ checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
98
+
99
+ [[package]]
100
+ name = "fastcrc"
101
+ version = "0.1.0"
102
+ dependencies = [
103
+ "crc-fast",
104
+ "magnus",
105
+ ]
106
+
107
+ [[package]]
108
+ name = "generic-array"
109
+ version = "0.14.7"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
112
+ dependencies = [
113
+ "typenum",
114
+ "version_check",
115
+ ]
116
+
117
+ [[package]]
118
+ name = "glob"
119
+ version = "0.3.3"
120
+ source = "registry+https://github.com/rust-lang/crates.io-index"
121
+ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
122
+
123
+ [[package]]
124
+ name = "itertools"
125
+ version = "0.13.0"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
128
+ dependencies = [
129
+ "either",
130
+ ]
131
+
132
+ [[package]]
133
+ name = "lazy_static"
134
+ version = "1.5.0"
135
+ source = "registry+https://github.com/rust-lang/crates.io-index"
136
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
137
+
138
+ [[package]]
139
+ name = "libc"
140
+ version = "0.2.186"
141
+ source = "registry+https://github.com/rust-lang/crates.io-index"
142
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
143
+
144
+ [[package]]
145
+ name = "libloading"
146
+ version = "0.8.9"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
149
+ dependencies = [
150
+ "cfg-if",
151
+ "windows-link",
152
+ ]
153
+
154
+ [[package]]
155
+ name = "magnus"
156
+ version = "0.8.2"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
159
+ dependencies = [
160
+ "magnus-macros",
161
+ "rb-sys",
162
+ "rb-sys-env",
163
+ "seq-macro",
164
+ ]
165
+
166
+ [[package]]
167
+ name = "magnus-macros"
168
+ version = "0.8.0"
169
+ source = "registry+https://github.com/rust-lang/crates.io-index"
170
+ checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
171
+ dependencies = [
172
+ "proc-macro2",
173
+ "quote",
174
+ "syn",
175
+ ]
176
+
177
+ [[package]]
178
+ name = "memchr"
179
+ version = "2.8.2"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
182
+
183
+ [[package]]
184
+ name = "minimal-lexical"
185
+ version = "0.2.1"
186
+ source = "registry+https://github.com/rust-lang/crates.io-index"
187
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
188
+
189
+ [[package]]
190
+ name = "nom"
191
+ version = "7.1.3"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
194
+ dependencies = [
195
+ "memchr",
196
+ "minimal-lexical",
197
+ ]
198
+
199
+ [[package]]
200
+ name = "proc-macro2"
201
+ version = "1.0.106"
202
+ source = "registry+https://github.com/rust-lang/crates.io-index"
203
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
204
+ dependencies = [
205
+ "unicode-ident",
206
+ ]
207
+
208
+ [[package]]
209
+ name = "quote"
210
+ version = "1.0.46"
211
+ source = "registry+https://github.com/rust-lang/crates.io-index"
212
+ checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
213
+ dependencies = [
214
+ "proc-macro2",
215
+ ]
216
+
217
+ [[package]]
218
+ name = "rb-sys"
219
+ version = "0.9.128"
220
+ source = "registry+https://github.com/rust-lang/crates.io-index"
221
+ checksum = "45ca28513560e56cfb79a62b1fce363c73af170a182024ce880c77ee9429920a"
222
+ dependencies = [
223
+ "rb-sys-build",
224
+ ]
225
+
226
+ [[package]]
227
+ name = "rb-sys-build"
228
+ version = "0.9.128"
229
+ source = "registry+https://github.com/rust-lang/crates.io-index"
230
+ checksum = "ce04b2c55eff3a21aaa623fcc655d94373238e72cac6b3e1a3641ff31649f99a"
231
+ dependencies = [
232
+ "bindgen",
233
+ "lazy_static",
234
+ "proc-macro2",
235
+ "quote",
236
+ "regex",
237
+ "shell-words",
238
+ "syn",
239
+ ]
240
+
241
+ [[package]]
242
+ name = "rb-sys-env"
243
+ version = "0.2.3"
244
+ source = "registry+https://github.com/rust-lang/crates.io-index"
245
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
246
+
247
+ [[package]]
248
+ name = "regex"
249
+ version = "1.12.4"
250
+ source = "registry+https://github.com/rust-lang/crates.io-index"
251
+ checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
252
+ dependencies = [
253
+ "aho-corasick",
254
+ "memchr",
255
+ "regex-automata",
256
+ "regex-syntax",
257
+ ]
258
+
259
+ [[package]]
260
+ name = "regex-automata"
261
+ version = "0.4.14"
262
+ source = "registry+https://github.com/rust-lang/crates.io-index"
263
+ checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
264
+ dependencies = [
265
+ "aho-corasick",
266
+ "memchr",
267
+ "regex-syntax",
268
+ ]
269
+
270
+ [[package]]
271
+ name = "regex-syntax"
272
+ version = "0.8.11"
273
+ source = "registry+https://github.com/rust-lang/crates.io-index"
274
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
275
+
276
+ [[package]]
277
+ name = "rustc-hash"
278
+ version = "2.1.2"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
281
+
282
+ [[package]]
283
+ name = "seq-macro"
284
+ version = "0.3.6"
285
+ source = "registry+https://github.com/rust-lang/crates.io-index"
286
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
287
+
288
+ [[package]]
289
+ name = "shell-words"
290
+ version = "1.1.1"
291
+ source = "registry+https://github.com/rust-lang/crates.io-index"
292
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
293
+
294
+ [[package]]
295
+ name = "shlex"
296
+ version = "1.3.0"
297
+ source = "registry+https://github.com/rust-lang/crates.io-index"
298
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
299
+
300
+ [[package]]
301
+ name = "spin"
302
+ version = "0.10.0"
303
+ source = "registry+https://github.com/rust-lang/crates.io-index"
304
+ checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
305
+
306
+ [[package]]
307
+ name = "syn"
308
+ version = "2.0.118"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
311
+ dependencies = [
312
+ "proc-macro2",
313
+ "quote",
314
+ "unicode-ident",
315
+ ]
316
+
317
+ [[package]]
318
+ name = "typenum"
319
+ version = "1.20.1"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
322
+
323
+ [[package]]
324
+ name = "unicode-ident"
325
+ version = "1.0.24"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
328
+
329
+ [[package]]
330
+ name = "version_check"
331
+ version = "0.9.5"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
334
+
335
+ [[package]]
336
+ name = "windows-link"
337
+ version = "0.2.1"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
data/Cargo.toml ADDED
@@ -0,0 +1,7 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/fastcrc"]
7
+ resolver = "2"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Yet Another AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,304 @@
1
+ # FastCRC
2
+
3
+ FastCRC is a Ruby gem for fast CRC checksum computation, backed by a Rust native extension and the [`crc-fast`](https://crates.io/crates/crc-fast) implementation.
4
+
5
+ It is built for Ruby applications that need CRC checksums in hot paths: object storage clients, upload/download verification, archival formats, wire protocols, and any workload where a pure Ruby or straightforward C implementation becomes visible in profiles.
6
+
7
+ ## Why FastCRC?
8
+
9
+ Ruby 3 made Rust a normal part of the Ruby ecosystem. YJIT is implemented in Rust, Ruby projects increasingly keep a Rust toolchain nearby, and native Rust extensions are much easier to adopt than they used to be.
10
+
11
+ At the same time, checksum requirements are getting more specific. APIs such as AWS S3's newer checksum flows require CRC64NVMe support, and that algorithm benefits from a backend designed for SIMD-friendly throughput.
12
+
13
+ FastCRC exists to make those optimized CRC implementations available from Ruby with a small, familiar API:
14
+
15
+ - Rust-backed CRC implementations through `crc-fast` and [`magnus`](https://github.com/matsadler/magnus).
16
+ - CRC-16, CRC-32, and CRC-64 dialects that overlap with [`digest-crc`](https://github.com/postmodern/digest-crc).
17
+ - CRC64NVMe support for modern storage APIs.
18
+ - One-shot and incremental APIs for strings, files, and streaming input.
19
+ - Fiber Scheduler and [`async`](https://rubygems.org/gems/async)-friendly chunked processing for better I/O behavior.
20
+
21
+ On supported workloads, the Rust backend can be tens of times faster than naive CRC implementations, commonly in the 60x to 100x range.
22
+
23
+ ## Installation
24
+
25
+ Add the gem to your application:
26
+
27
+ ```bash
28
+ bundle add fastcrc
29
+ ```
30
+
31
+ Or install it directly:
32
+
33
+ ```bash
34
+ gem install fastcrc
35
+ ```
36
+
37
+ FastCRC requires Ruby 3.2 or newer. Installing from source requires a working Rust toolchain because the gem builds a native extension.
38
+
39
+ ## Usage
40
+
41
+ Require the gem and call the CRC class you need:
42
+
43
+ ```ruby
44
+ require "fastcrc"
45
+
46
+ FastCRC::CRC32.hexdigest("123456789")
47
+ # => "cbf43926"
48
+
49
+ FastCRC::CRC32.checksum("123456789")
50
+ # => 3421780262
51
+
52
+ FastCRC::CRC64NVMe.hexdigest("hello world!")
53
+ # => "d9160d1fa8e418e3"
54
+
55
+ FastCRC::CRC64NVMe.checksum("hello world!")
56
+ # => 15655158020120117219
57
+ ```
58
+
59
+ The APIs accept binary strings:
60
+
61
+ ```ruby
62
+ FastCRC::CRC32.hexdigest("\x00\xFF\x80".b)
63
+ # => "81dda740"
64
+ ```
65
+
66
+ ## Streaming Input
67
+
68
+ For large files or streaming input, create an instance and call `#update` with each chunk:
69
+
70
+ ```ruby
71
+ digest = FastCRC::CRC32.new
72
+
73
+ File.open("large.bin", "rb") do |file|
74
+ while (chunk = file.read(8192))
75
+ digest.update(chunk)
76
+ end
77
+ end
78
+
79
+ digest.hexdigest
80
+ ```
81
+
82
+ Instance methods mirror the one-shot class methods:
83
+
84
+ - `#update(data)` appends data to the running checksum.
85
+ - `#checksum` returns the current checksum as an integer.
86
+ - `#hexdigest` returns the current checksum as a lowercase hex string.
87
+ - `#reset` clears the current state so the instance can be reused.
88
+
89
+ ### Fiber Scheduler And Async
90
+
91
+ FastCRC's incremental API works well with scheduler-aware I/O. With a fiber scheduler, your code can read a chunk, update the checksum, and yield so other fibers can continue making progress:
92
+
93
+ ```ruby
94
+ require "async"
95
+
96
+ Async do |task|
97
+ digest = FastCRC::CRC64NVMe.new
98
+
99
+ File.open("large.bin", "rb") do |file|
100
+ while (chunk = file.read(8192))
101
+ digest.update(chunk)
102
+ task.yield
103
+ end
104
+ end
105
+
106
+ puts digest.hexdigest
107
+ end
108
+ ```
109
+
110
+ This is useful for clients that validate large uploads or downloads while sharing an event loop with other network or file I/O.
111
+
112
+ ## Supported Algorithms
113
+
114
+ FastCRC mirrors the CRC dialects that overlap with `digest-crc`.
115
+
116
+ CRC-16:
117
+
118
+ - `FastCRC::CRC16`
119
+ - `FastCRC::CRC16CCITT`
120
+ - `FastCRC::CRC16DNP`
121
+ - `FastCRC::CRC16Genibus`
122
+ - `FastCRC::CRC16Kermit`
123
+ - `FastCRC::CRC16Modbus`
124
+ - `FastCRC::CRC16QT`
125
+ - `FastCRC::CRC16USB`
126
+ - `FastCRC::CRC16X25`
127
+ - `FastCRC::CRC16XModem`
128
+ - `FastCRC::CRC16ZModem`
129
+
130
+ CRC-32:
131
+
132
+ - `FastCRC::CRC32`
133
+ - `FastCRC::CRC32BZip2`
134
+ - `FastCRC::CRC32c`
135
+ - `FastCRC::CRC32Jam`
136
+ - `FastCRC::CRC32MPEG`
137
+ - `FastCRC::CRC32Mpeg`
138
+ - `FastCRC::CRC32POSIX`
139
+ - `FastCRC::CRC32XFER`
140
+
141
+ CRC-64:
142
+
143
+ - `FastCRC::CRC64`
144
+ - `FastCRC::CRC64Jones`
145
+ - `FastCRC::CRC64NVMe`
146
+ - `FastCRC::CRC64XZ`
147
+
148
+ ## Benchmarks
149
+
150
+ Benchmark FastCRC against `digest-crc` with:
151
+
152
+ ```bash
153
+ bundle exec rake benchmark:digest_crc
154
+ ```
155
+
156
+ The benchmark compares incremental `#update` performance for the supported `digest-crc` overlap. Tune the workload with `ITERATIONS`, `SAMPLE_COUNT`, and `BLOCK_SIZE`:
157
+
158
+ ```bash
159
+ ITERATIONS=5 SAMPLE_COUNT=500 BLOCK_SIZE=16384 bundle exec rake benchmark:digest_crc
160
+ ```
161
+
162
+ Benchmark results on M4 Pro CPU:
163
+
164
+ ```
165
+ Ruby 4.0.5 (ruby)
166
+ digest-crc 0.7.0
167
+ Samples: 1000 x 8192 bytes
168
+ Iterations: 10
169
+
170
+ CRC16
171
+ user system total real
172
+ FastCRC::CRC16#update 0.001703 0.000031 0.001734 ( 0.001733)
173
+ Digest::CRC16#update 0.145404 0.000458 0.145862 ( 0.146030)
174
+
175
+ CRC16 CCITT
176
+ user system total real
177
+ FastCRC::CRC16CCITT#update 0.001919 0.000018 0.001937 ( 0.001937)
178
+ Digest::CRC16CCITT#update 0.161412 0.000472 0.161884 ( 0.162138)
179
+
180
+ CRC16 DNP
181
+ user system total real
182
+ FastCRC::CRC16DNP#update 0.146592 0.000701 0.147293 ( 0.147627)
183
+ Digest::CRC16DNP#update 0.139462 0.000579 0.140041 ( 0.140277)
184
+
185
+ CRC16 Genibus
186
+ user system total real
187
+ FastCRC::CRC16Genibus#update 0.001894 0.000002 0.001896 ( 0.001894)
188
+ Digest::CRC16Genibus#update 0.156035 0.000393 0.156428 ( 0.156633)
189
+
190
+ CRC16 Kermit
191
+ user system total real
192
+ FastCRC::CRC16Kermit#update 0.001428 0.000003 0.001431 ( 0.001430)
193
+ Digest::CRC16Kermit#update 0.140393 0.000410 0.140803 ( 0.140935)
194
+
195
+ CRC16 Modbus
196
+ user system total real
197
+ FastCRC::CRC16Modbus#update 0.001444 0.000004 0.001448 ( 0.001449)
198
+ Digest::CRC16Modbus#update 0.140009 0.000583 0.140592 ( 0.140810)
199
+
200
+ CRC16 QT
201
+ user system total real
202
+ FastCRC::CRC16QT#update 0.001421 0.000004 0.001425 ( 0.001424)
203
+ Digest::CRC16QT#update 0.139679 0.000327 0.140006 ( 0.140081)
204
+
205
+ CRC16 USB
206
+ user system total real
207
+ FastCRC::CRC16USB#update 0.001429 0.000036 0.001465 ( 0.001465)
208
+ Digest::CRC16USB#update 0.140984 0.000484 0.141468 ( 0.141715)
209
+
210
+ CRC16 X25
211
+ user system total real
212
+ FastCRC::CRC16X25#update 0.001426 0.000006 0.001432 ( 0.001433)
213
+ Digest::CRC16X25#update 0.139800 0.000577 0.140377 ( 0.140534)
214
+
215
+ CRC16 XModem
216
+ user system total real
217
+ FastCRC::CRC16XModem#update 0.001892 0.000001 0.001893 ( 0.001892)
218
+ Digest::CRC16XModem#update 0.156624 0.000414 0.157038 ( 0.157100)
219
+
220
+ CRC16 ZModem
221
+ user system total real
222
+ FastCRC::CRC16ZModem#update 0.001958 0.000001 0.001959 ( 0.001961)
223
+ Digest::CRC16ZModem#update 0.157277 0.000434 0.157711 ( 0.157864)
224
+
225
+ CRC32
226
+ user system total real
227
+ FastCRC::CRC32#update 0.001688 0.000003 0.001691 ( 0.001691)
228
+ Digest::CRC32#update 0.138896 0.000670 0.139566 ( 0.139735)
229
+
230
+ CRC32 BZip2
231
+ user system total real
232
+ FastCRC::CRC32BZip2#update 0.001880 0.000009 0.001889 ( 0.001889)
233
+ Digest::CRC32BZip2#update 0.137953 0.000616 0.138569 ( 0.138768)
234
+
235
+ CRC32c
236
+ user system total real
237
+ FastCRC::CRC32c#update 0.001811 0.000001 0.001812 ( 0.001813)
238
+ Digest::CRC32c#update 0.138962 0.000351 0.139313 ( 0.139526)
239
+
240
+ CRC32 Jam
241
+ user system total real
242
+ FastCRC::CRC32Jam#update 0.001480 0.000003 0.001483 ( 0.001481)
243
+ Digest::CRC32Jam#update 0.138885 0.000232 0.139117 ( 0.139282)
244
+
245
+ CRC32 MPEG
246
+ user system total real
247
+ FastCRC::CRC32MPEG#update 0.001864 0.000001 0.001865 ( 0.001864)
248
+ Digest::CRC32MPEG#update 0.137355 0.000277 0.137632 ( 0.137757)
249
+
250
+ CRC32 POSIX
251
+ user system total real
252
+ FastCRC::CRC32POSIX#update 0.002034 0.000009 0.002043 ( 0.002049)
253
+ Digest::CRC32POSIX#update 0.140943 0.000757 0.141700 ( 0.142165)
254
+
255
+ CRC32 XFER
256
+ user system total real
257
+ FastCRC::CRC32XFER#update 0.002024 0.000004 0.002028 ( 0.002029)
258
+ Digest::CRC32XFER#update 0.144710 0.001249 0.145959 ( 0.146233)
259
+
260
+ CRC64
261
+ user system total real
262
+ FastCRC::CRC64#update 0.001410 0.000001 0.001411 ( 0.001408)
263
+ Digest::CRC64#update 0.141028 0.000632 0.141660 ( 0.141901)
264
+
265
+ CRC64 Jones
266
+ user system total real
267
+ FastCRC::CRC64Jones#update 0.001432 0.000001 0.001433 ( 0.001433)
268
+ Digest::CRC64Jones#update 0.145503 0.001425 0.146928 ( 0.147631)
269
+
270
+ CRC64 NVMe
271
+ user system total real
272
+ FastCRC::CRC64NVMe#update 0.001486 0.000001 0.001487 ( 0.001486)
273
+ Digest::CRC64NVMe#update 0.143874 0.000934 0.144808 ( 0.145643)
274
+
275
+ CRC64 XZ
276
+ user system total real
277
+ FastCRC::CRC64XZ#update 0.001425 0.000002 0.001427 ( 0.001424)
278
+ Digest::CRC64XZ#update 0.139581 0.000869 0.140450 ( 0.140569)
279
+ ```
280
+
281
+ ## Development
282
+
283
+ After checking out the repo, install dependencies and run the test suite:
284
+
285
+ ```bash
286
+ bin/setup
287
+ rake test
288
+ ```
289
+
290
+ Run the full default task with:
291
+
292
+ ```bash
293
+ rake
294
+ ```
295
+
296
+ To install this gem onto your local machine:
297
+
298
+ ```bash
299
+ bundle exec rake install
300
+ ```
301
+
302
+ ## License
303
+
304
+ FastCRC is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).