-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6171d71
Showing
20 changed files
with
2,598 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# chksum-cli | ||
|
||
[![GitHub](https://img.shields.io/badge/github-ferric--bytes%2Fchksum--cli-24292e?style=flat-square&logo=github "GitHub")](https://github.com/ferric-bytes/chksum-cli) | ||
[![Coverage](https://img.shields.io/codecov/c/gh/ferric-bytes/chksum-cli?style=flat-square&logo=codecov "Coverage")](https://app.codecov.io/gh/ferric-bytes/chksum-cli) | ||
[![MSRV](https://img.shields.io/badge/MSRV-1.66.0-informational?style=flat-square "MSRV")](https://github.com/ferric-bytes/chksum-cli/blob/master/Cargo.toml) | ||
[![deps.rs](https://deps.rs/crate/chksum-cli/0.2.0/status.svg?style=flat-square "deps.rs")](https://deps.rs/crate/chksum-cli/0.2.0) | ||
[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square "unsafe forbidden")](https://github.com/rust-secure-code/safety-dance) | ||
[![LICENSE](https://img.shields.io/github/license/ferric-bytes/chksum-cli?style=flat-square "LICENSE")](https://github.com/ferric-bytes/chksum-cli/blob/master/LICENSE) | ||
|
||
A simple checksum calculator. | ||
|
||
## Motivation | ||
|
||
There are variety of tools that allows calculate hash digests. | ||
|
||
However tools like `md5sum`, `sha1sum`, `b2sum`, `sha224sum` and others offer only file-based checksums. | ||
|
||
```shell | ||
find dir/ -type f | sort | xargs cat | sha224sum | ||
``` | ||
|
||
Instead you can just use `chksum` with preffered hash algorithm. | ||
|
||
```sh | ||
chksum sha2-224 dir/ | ||
``` | ||
|
||
## Features | ||
|
||
- Written in pure Rust | ||
- No unsafe code | ||
- Multithread | ||
|
||
## Installation | ||
|
||
Use [`cargo install`](https://doc.rust-lang.org/cargo/commands/cargo-install.html) to install `chksum` binary in `$HOME/.cargo/bin` directory. | ||
|
||
```shell | ||
cargo install chksum-cli | ||
``` | ||
|
||
## Usage | ||
|
||
```shell | ||
$ chksum help | ||
A simple checksum calculator. | ||
|
||
Usage: chksum <COMMAND> | ||
|
||
Commands: | ||
md5 Calculate MD5 digest | ||
sha1 Calculate SHA-1 digest | ||
sha2-224 Calculate SHA-2 224 digest | ||
sha2-256 Calculate SHA-2 256 digest | ||
sha2-384 Calculate SHA-2 384 digest | ||
sha2-512 Calculate SHA-2 512 digest | ||
help Print this message or the help of the given subcommand(s) | ||
|
||
Options: | ||
-h, --help Print help | ||
-V, --version Print version | ||
``` | ||
|
||
```shell | ||
$ chksum help sha2-224 | ||
Calculate SHA-2 224 digest | ||
|
||
Usage: chksum sha2-224 <PATH>... | ||
|
||
Arguments: | ||
<PATH>... Path to file or directory | ||
|
||
Options: | ||
-h, --help Print help | ||
``` | ||
|
||
```shell | ||
$ chksum sha2-224 LICENSE | ||
99258bca0d23c69388dd53412f1009132753b89459359a401a6ed158 LICENSE | ||
``` | ||
|
||
```shell | ||
$ chksum sha1 src/ | ||
598c9268d2078e12bc0c32ff40ebb8ee9f8351ea src/ | ||
``` | ||
|
||
## Library | ||
|
||
Check [`chksum`](https://crates.io/crates/chksum) crate to see the library that allows you to calculate digests of files and directories with easy-to-use interface. | ||
|
||
## Hash algorithms | ||
|
||
Implemented hash algorithms: | ||
|
||
* MD5 - [RFC 1321: The MD5 Message-Digest Algorithm](https://tools.ietf.org/html/rfc1321) | ||
* SHA-1 - [RFC 3174: US Secure Hash Algorithm 1 (SHA1)](https://tools.ietf.org/html/rfc3174) | ||
* SHA-2 family (SHA-224, SHA-256, SHA-386, SHA-512) - [FIPS PUB 180-4: Secure Hash Standard](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) | ||
|
||
## Disclaimer | ||
|
||
Code is under development. The interface may change in the future. | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
name: Rust | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
paths: | ||
- ".github/workflows/*.yml" | ||
- "Cargo.toml" | ||
- "src/**.rs" | ||
- "tests/**.rs" | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
paths: | ||
- ".github/workflows/*.yml" | ||
- "Cargo.toml" | ||
- "src/**.rs" | ||
- "tests/**.rs" | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
name: Lint | ||
permissions: | ||
checks: write | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
default: true | ||
profile: minimal | ||
components: rustfmt, clippy | ||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --check --verbose | ||
- name: Run cargo clippy | ||
uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-features -- --deny clippy::cargo | ||
|
||
deny: | ||
runs-on: ubuntu-latest | ||
name: Deny | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
default: true | ||
profile: minimal | ||
- name: Install cargo deny | ||
uses: actions-rs/install@v0.1 | ||
with: | ||
crate: cargo-deny | ||
- name: Run cargo deny | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: deny | ||
args: --all-features check | ||
|
||
security-audit: | ||
name: Security Audit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
profile: minimal | ||
- name: Run audit check | ||
uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-and-test-linux: | ||
needs: | ||
- deny | ||
- lint | ||
- security-audit | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [1.66.0, stable, nightly] | ||
name: "Build and test (OS: Linux, Toolchain: ${{ matrix.toolchain }})" | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
default: true | ||
profile: minimal | ||
- name: Run cargo build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --all-features --verbose | ||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features --verbose | ||
|
||
build-and-test-macos: | ||
needs: | ||
- deny | ||
- lint | ||
- security-audit | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [1.66.0, stable, nightly] | ||
name: "Build and test (OS: MacOS, Toolchain: ${{ matrix.toolchain }})" | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
default: true | ||
profile: minimal | ||
- name: Run cargo build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --all-features --verbose | ||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features --verbose | ||
|
||
build-and-test-windows: | ||
needs: | ||
- deny | ||
- lint | ||
- security-audit | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [1.66.0, stable, nightly] | ||
name: "Build and test (OS: Windows, Toolchain: ${{ matrix.toolchain }})" | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
default: true | ||
profile: minimal | ||
- name: Run cargo build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --all-features --verbose | ||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features --verbose | ||
|
||
coverage: | ||
needs: | ||
- deny | ||
- lint | ||
- security-audit | ||
runs-on: ubuntu-latest | ||
name: Coverage | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
default: true | ||
profile: minimal | ||
- name: Install cargo tarpaulin | ||
uses: actions-rs/install@v0.1 | ||
with: | ||
crate: cargo-tarpaulin | ||
- name: Run cargo tarpaulin | ||
run: cargo tarpaulin --all-features --fail-under 50 --follow-exec --ignore-tests --out xml --timeout 120 | ||
- name: Upload to codecov.io | ||
if: ${{ always() }} | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Cargo | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [0.2.0] - 2023-08-13 | ||
|
||
### Added | ||
|
||
- Initial release. | ||
|
||
[0.2.0]: https://github.com/ferric-bytes/chksum/releases/tag/v0.2.0 |
Oops, something went wrong.