|
8 | 8 | [中文文档](./README_zh.md) |
9 | 9 |
|
10 | 10 | ezcheck(easy check) is an easy-to-use, lightweight, cross-platform, and high-performance tool for calculating, |
11 | | -comparing, and verifying hash of strings and files. |
| 11 | +comparing, and verifying hash of strings and files. Designed to prevent content tampering and ensure file integrity. |
12 | 12 |
|
13 | 13 | ezcheck have three backends: [ring](https://docs.rs/ring), [hashes](https://docs.rs/hashes) and mix |
14 | 14 | backend([ring](https://docs.rs/ring) and [hashes](https://docs.rs/hashes)), and you can only choose |
15 | 15 | one of them. The main differences between them are: |
16 | 16 |
|
17 | | -| Features | ring | hashes | mix | |
18 | | -|----------------------|------------------------------------------------------------|-----------------------------------------------------------------|-----------------------------------------------------------------| |
19 | | -| Speed | Fast. | About 5 times slower than ring. | Use the fastest backend that supports the algorithm. | |
20 | | -| Supported algorithms | SHA256, SHA384, SHA512, SHA512/256 | MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512/256 | MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512/256 | |
21 | | -| Implement languages | Assembly, Rust, C and etc.. | Rust | Assembly, Rust, C and etc.. | |
22 | | -| Compatibility | May not work on every machine with different architecture. | Works well with Rust. | Same to ring. | |
| 17 | +| Features | ring | hashes | mix(Recommended) | |
| 18 | +|----------------------|------------------------------------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------| |
| 19 | +| Speed | Fast. | About 5 times slower than ring. | Use the fastest backend that supports the algorithm. | |
| 20 | +| Supported algorithms | SHA256, SHA384, SHA512, SHA512/256 | MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512/256 | MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512/256, XXH32, XXH64, XXH3_64 | |
| 21 | +| Implement languages | Assembly, Rust, C and etc.. | Rust | Assembly, Rust, C and etc.. | |
| 22 | +| Compatibility | May not work on every machine with different architecture. | Works well with Rust. | Same to ring. | |
23 | 23 |
|
24 | 24 | ❗️ To achieve both fastest speed and maximum compatibility, the default backend is **mix backend**. |
25 | 25 |
|
@@ -98,6 +98,9 @@ Supported hash algorithms of different backends: |
98 | 98 | | SHA384 | SHA384 | SHA384 (ring backend) | |
99 | 99 | | SHA512 | SHA512 | SHA512 (ring backend) | |
100 | 100 | | SHA512/256 | SHA512/256 | SHA512/256 (ring backend) | |
| 101 | +| | | XXH32 | |
| 102 | +| | | XXH64 | |
| 103 | +| | | XXH3_64 | |
101 | 104 |
|
102 | 105 | ### Calculate |
103 | 106 |
|
@@ -198,37 +201,80 @@ image.jpg: SHA256 OK |
198 | 201 |
|
199 | 202 | ## Benchmark |
200 | 203 |
|
201 | | -### Method |
| 204 | +### SHA256 Benchmark Tests |
| 205 | + |
| 206 | +#### Method |
| 207 | + |
| 208 | +* Device: MacBook Air M1 8GB |
| 209 | + |
| 210 | +* Steps |
| 211 | + |
| 212 | + 1. Run and repeat 3 times: |
| 213 | + ```bash |
| 214 | + $ count=10000 # Test size = 1MiB * $count |
| 215 | + $ # Bare, Speed of generating the data |
| 216 | + $ dd if=/dev/zero bs=1M count=$count | pv > /dev/null |
| 217 | + $ # ezcheck-hashes |
| 218 | + $ dd if=/dev/zero bs=1M count=$count | pv | ./ezcheck-hashes calculate sha256 -f - |
| 219 | + $ # ezcheck-ring |
| 220 | + $ dd if=/dev/zero bs=1M count=$count | pv | ./ezcheck-ring calculate sha256 -f - |
| 221 | + $ # sha256sum |
| 222 | + $ dd if=/dev/zero bs=1M count=$count | pv | sha256sum |
| 223 | + ``` |
| 224 | + |
| 225 | + 2. Calculate the average value. |
| 226 | + |
| 227 | +#### Result |
| 228 | + |
| 229 | +| Implementation / Speed(GiB/s) / Test size(MiB) | 1 | 100 | 500 | 1000 | 5000 | 10000 | |
| 230 | +|------------------------------------------------|------|------|------|------|------|-------| |
| 231 | +| Bare (Speed of generating the data) | 2.13 | 3.02 | 4.59 | 5.31 | 5.97 | 6.07 | |
| 232 | +| ezcheck-hashes | 0.13 | 0.28 | 0.29 | 0.30 | 0.30 | 0.30 | |
| 233 | +| ezcheck-ring | 0.58 | 1.24 | 1.57 | 1.63 | 1.68 | 1.68 | |
| 234 | +| sha256sum | 0.73 | 1.26 | 1.63 | 1.69 | 1.75 | 1.81 | |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | +### Speed vs. Algorithms, Implementations |
| 239 | + |
| 240 | +#### Method |
202 | 241 |
|
203 | 242 | * Device: MacBook Air M1 8GB |
204 | 243 |
|
205 | | -* Steps: |
206 | | - |
207 | | -1. Run and repeat 3 times: |
208 | | - ```bash |
209 | | - $ count=10000 # Test size = 1MiB * $count |
210 | | - $ # Bare, Speed of generating the data |
211 | | - $ dd if=/dev/zero bs=1M count=$count | pv > /dev/null |
212 | | - $ # ezcheck-hashes |
213 | | - $ dd if=/dev/zero bs=1M count=$count | pv | ./ezcheck-hashes calculate sha256 -f - |
214 | | - $ # ezcheck-ring |
215 | | - $ dd if=/dev/zero bs=1M count=$count | pv | ./ezcheck-ring calculate sha256 -f - |
216 | | - $ # sha256sum |
217 | | - $ dd if=/dev/zero bs=1M count=$count | pv | sha256sum |
218 | | - ``` |
219 | | - |
220 | | -2. Calculate the average value. |
221 | | - |
222 | | -### Result |
223 | | - |
224 | | -| Command/Speed(GiB/s)/Test size(MiB) | 1 | 100 | 500 | 1000 | 5000 | 10000 | |
225 | | -|-------------------------------------|------|------|------|------|------|-------| |
226 | | -| Bare (Speed of generating the data) | 2.13 | 3.02 | 4.59 | 5.31 | 5.97 | 6.07 | |
227 | | -| ezcheck-hashes | 0.13 | 0.28 | 0.29 | 0.30 | 0.30 | 0.30 | |
228 | | -| ezcheck-ring | 0.58 | 1.24 | 1.57 | 1.63 | 1.68 | 1.68 | |
229 | | -| sha256sum | 0.73 | 1.26 | 1.63 | 1.69 | 1.75 | 1.81 | |
230 | | - |
231 | | - |
| 244 | +* Steps |
| 245 | + |
| 246 | + 1. Run: |
| 247 | + ```bash |
| 248 | + $ algorithm=sha256 |
| 249 | + $ # ezcheck-hashes |
| 250 | + $ dd if=/dev/zero bs=1M count=10000 | pv | ./ezcheck-hashes calculate $algorithm -f - |
| 251 | + $ # ezcheck-ring |
| 252 | + $ dd if=/dev/zero bs=1M count=10000 | pv | ./ezcheck-ring calculate $algorithm -f - |
| 253 | + $ # ezcheck-mix |
| 254 | + $ dd if=/dev/zero bs=1M count=10000 | pv | ./ezcheck-mix calculate $algorithm -f - |
| 255 | + ``` |
| 256 | + 2. Calculate the average value. |
| 257 | + |
| 258 | +#### Result |
| 259 | + |
| 260 | +| Algorithms / Speed(GiB/s) / Implementations | ring | hashes | mix | |
| 261 | +|---------------------------------------------|--------|----------|----------| |
| 262 | +| MD2 | null* | 0.00896 | 0.00896 | |
| 263 | +| MD4 | null* | 0.852 | 0.852 | |
| 264 | +| MD5 | null* | 0.549 | 0.549 | |
| 265 | +| SHA1 | null* | 0.802 | 0.802 | |
| 266 | +| SHA224 | null* | 0.299 | 0.299 | |
| 267 | +| SHA256 | 1.69 | 0.298 | 1.70 | |
| 268 | +| SHA384 | 1.12 | 0.473 | 1.13 | |
| 269 | +| SHA512 | 1.13 | 0.473 | 1.13 | |
| 270 | +| SHA512/256 | 1.13 | 0.473 | 1.13 | |
| 271 | +| XXHASH32 | null* | null* | 2.45 | |
| 272 | +| XXHASH64 | null* | null* | 3.27 | |
| 273 | +| XXHASH3_64 | null* | null* | 3.65 | |
| 274 | + |
| 275 | +_null*: The algorithm is not implemented in this implementation._ |
| 276 | + |
| 277 | + |
232 | 278 |
|
233 | 279 | ## License |
234 | 280 |
|
|
0 commit comments