Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An easy-to-use, lightweight, cross-platform, and high-performance tool for calculating, comparing, and verifying hash of strings and files.

License

NotificationsYou must be signed in to change notification settings

Metaphorme/ezcheck

Repository files navigation

BuildTestCrates.io VersionMirror Gitee

中文文档

ezcheck(easy check) is an easy-to-use, lightweight, cross-platform, and high-performance tool for calculating,comparing, and verifying hash of strings and files. Designed to prevent content tampering and ensure file integrity.

ezcheck have three backends:ring,hashes and mixbackend(ring andhashes), and you can only chooseone of them. The main differences between them are:

Featuresringhashesmix(Recommended)
SpeedFast.About 5 times slower than ring.Use the fastest backend that supports the algorithm.
Supported algorithmsSHA256, SHA384, SHA512, SHA512/256MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512/256MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA512/256, XXHASH32, XXHASH64, XXHASH3_64
Implement languagesAssembly, Rust, C and etc..RustAssembly, Rust, C and etc..
CompatibilityMay not work on every machine with different architecture.Works well with Rust.Same to ring.

❗️ To achieve both fastest speed and maximum compatibility, the default backend ismix backend.

⚠️ Please notice that although ezcheck supports a lot of hash algorithms,MD2,MD4,MD5,SHA1 are proven to beinsecure. ezcheck still provides them for maximum compatibility, butit does not recommend users continue to usethem.

Setup

Direct Binary Download

Download the suitablemix backend binary from therelease.

Install from Cargo

$# mix backend$ cargo install ezcheck$# ring backend$ cargo install ezcheck --no-default-features --features ring_backend$# hashes backend$ cargo install ezcheck --no-default-features --features hashes_backend

Instantly run ezcheck with x-cmd

x-cmd is a lightweight cross-platform package manager implemented in posix shell. Quickly downloadand executeezcheck with a single command:x ezcheck

You can also installezcheck in the user level without requiring root privileges:

$ x env use ezcheck

Build from source

MSRV

Build

$ git clone https://github.com/Metaphorme/ezcheck&&cd ezcheck$# Choose one from mix backend, hashes backend or ring backend$# mix backend$ cargo build --release$# ring backend$ cargo build --release --no-default-features --features ring_backend$# hashes backend$ cargo build --release --no-default-features --features hashes_backend$$ ./target/release/ezcheck --version

Run tests

$ git clone https://github.com/Metaphorme/ezcheck&&cd ezcheck$ cargotest# mix backend$ cargotest --no-default-features --features ring_backend# ring backend$ cargotest --no-default-features --features hashes_backend# hashes backend

Usage

Supported hash algorithms of different backends:

ringhashesmix
MD2MD2 (hashes backend)
MD4MD4 (hashes backend)
MD5MD5 (hashes backend)
SHA1SHA1 (hashes backend)
SHA224SHA224 (hashes backend)
SHA256SHA256SHA256 (ring backend)
SHA384SHA384SHA384 (ring backend)
SHA512SHA512SHA512 (ring backend)
SHA512/256SHA512/256SHA512/256 (ring backend)
XXHASH32
XXHASH64
XXHASH3_64

Calculate

Calculate hash for file(s) or text.

$# Usage:$#  ezcheck calculate|c [ALGORITHM (Default SHA256)] (-f file(s)/"-" for standard input | -t text)$$# Examples:$ ezcheck c sha256 -f image.jpgb4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2  image.jpg$$ cat image.jpg| ezcheck calculate sha256 -f -b4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2  -$$ ezcheck calculate sha256 -t"Hello"SHA256:  185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969$$ ezcheck calculate -f image.jpgNo algorithm specified. Using SHA256 as the default.b4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2  image.jpg$$# We could also redirect the output into a file, just like shasum does.$ ezcheck calculate sha256 -f image.jpg> sha256sum.txt

Compare

Compare with given hash.

$# Usage:$#  ezcheck compare|m [ALGORITHM (Leave blank to automatically detect algorithm)] (-f file/"-" for standard input | -t text) -c hash$  $# Examples:$ ezcheck m sha256 -f image.jpg -c b4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2SHA256 OK$$ cat image.jpg| ezcheck compare sha256 -f - -c b4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2                           SHA256 OK$$ ezcheck compare sha256 -t"Hello" -c 085f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969SHA256 FAILED  Current Hash:  185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969$$# Auto detect hash algorithm$ ezcheck compare -f image.jpg -c b68c5da64847c4d8fd046ea6d6b4739fINFO: Hash Algorithm could be MD5, MD4, MD2MD5 FAILED  Current Hash:  c8d0b68ed0abd920f9388973aa5a926eMD4 OK

Check

Check with given shasum-style check file.

shasum-style check file could be generated fromshasumandezcheck. It looks like:

00691413c731ee37f551bfaca6a34b8443b3e85d7c0816a6fe90aa8fc8eaec95  滕王阁序.txtb4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2 *image.jpg
$# Usage:$#  ezcheck check|k [ALGORITHM (Leave blank to automatically detect algorithm)] -c check-file$$# Warning: The shasum file (or check file) should be in the same directory with files to be checked.$# Example:$ ezcheck k sha256 -c sha256sum.txt 滕王阁序.txt: SHA256 OKimage.jpg: SHA256 OK$$# Auto detect hash algorithm$ cat md4sum.txt9ec44ac67ab1e1c98fe0406478d5297d  滕王阁序.txtb68c5da64847c4d8fd046ea6d6b4739f  image.jpg$ ezcheck check -c md4sum.txt滕王阁序.txt: MD5 FAILED  Current Hash:  07c4e6a2c2db5f2d3a8998a3dba84a96滕王阁序.txt: MD4 OKimage.jpg: MD5 FAILED  Current Hash:  c8d0b68ed0abd920f9388973aa5a926eimage.jpg: MD4 OK$$# Actually, ezcheck supports various algorithm in the same check file in auto detect.$# 🤔 But why this happens?$ cat sha256sum.txt00691413c731ee37f551bfaca6a34b8443b3e85d7c0816a6fe90aa8fc8eaec95  滕王阁序.txtb4c5e1d0a1f84a07ef6f329d3dcec62bce40103f49d8088e2b1b98a87e4ff0c2*image.jpg9ec44ac67ab1e1c98fe0406478d5297d  滕王阁序.txt$$ ezcheck check -c sha256sum.txt滕王阁序.txt: SHA256 OKimage.jpg: SHA256 OK滕王阁序.txt: MD5 FAILED  Current Hash:  07c4e6a2c2db5f2d3a8998a3dba84a96滕王阁序.txt: MD4 OK

Benchmark

SHA256 Benchmark Tests

Method

  • Device: MacBook Air M1 8GB

  • Steps

    1. Run and repeat 3 times:

      $ count=10000# Test size = 1MiB * $count$# Bare, Speed of generating the data$ dd if=/dev/zero bs=1M count=$count| pv> /dev/null$# ezcheck-hashes$ dd if=/dev/zero bs=1M count=$count| pv| ./ezcheck-hashes calculate sha256 -f -$# ezcheck-ring$ dd if=/dev/zero bs=1M count=$count| pv| ./ezcheck-ring calculate sha256 -f -$# sha256sum$ dd if=/dev/zero bs=1M count=$count| pv| sha256sum
    2. Calculate the average value.

Result

Implementation / Speed(GiB/s) / Test size(MiB)11005001000500010000
Bare (Speed of generating the data)2.133.024.595.315.976.07
ezcheck-hashes0.130.280.290.300.300.30
ezcheck-ring0.581.241.571.631.681.68
sha256sum0.731.261.631.691.751.81

benchmark

Speed vs. Algorithms, Implementations

Method

  • Device: MacBook Air M1 8GB

  • Steps

    1. Run:
      $ algorithm=sha256$# ezcheck-hashes$ dd if=/dev/zero bs=1M count=10000| pv| ./ezcheck-hashes calculate$algorithm -f -$# ezcheck-ring$ dd if=/dev/zero bs=1M count=10000| pv| ./ezcheck-ring calculate$algorithm -f -$# ezcheck-mix$ dd if=/dev/zero bs=1M count=10000| pv| ./ezcheck-mix calculate$algorithm -f -
    2. Calculate the average value.

Result

Algorithms / Speed(GiB/s) / Implementationsringhashesmix
MD2null*0.008960.00896
MD4null*0.8520.852
MD5null*0.5490.549
SHA1null*0.8020.802
SHA224null*0.2990.299
SHA2561.690.2981.70
SHA3841.120.4731.13
SHA5121.130.4731.13
SHA512/2561.130.4731.13
XXHASH32null*null*2.45
XXHASH64null*null*3.27
XXHASH3_64null*null*3.65

null*: The algorithm is not implemented in this implementation.

benchmark

License

MIT LicenseCopyright (c) 2024 Heqi LiuPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

About

An easy-to-use, lightweight, cross-platform, and high-performance tool for calculating, comparing, and verifying hash of strings and files.

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp