# chksum-cli
[](https://crates.io/crates/chksum-cli)
[](https://github.com/chksum-rs/cli/actions/workflows/rust.yml)
[](https://github.com/chksum-rs/cli/blob/master/Cargo.toml)
[](https://deps.rs/crate/chksum/0.4.1)
[](https://github.com/rust-secure-code/safety-dance)
[](https://github.com/chksum-rs/cli/blob/master/LICENSE)
A simple checksum calculator.
## Motivation
Various tools like `md5sum`, `sha1sum`, `b2sum`, `sha224sum`, etc., allow users to calculate file-based hash digests. However, these tools focus on file-level checksums, making it cumbersome to handle scenarios like calculating digests of whole directories. This motivated the creation of `chksum` to offer a simplified interface for such use cases.
```shell
With `chksum`, you can achieve the same result with your preferred hash algorithm:
```sh
chksum sha2-224 dir/
```
## Key Features
* Implemented in pure Rust
* No unsafe code
* Configurable via Cargo features
* Multithreaded
## Installation
Install the `chksum` binary using [`cargo install`](https://doc.rust-lang.org/cargo/commands/cargo-install.html):
```shell
cargo install chksum-cli
```
## Usage
### General Help
```shell
$ chksum help
A simple checksum calculator.
Usage: chksum [OPTIONS] <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:
-c, --color <COLOR> Show colored output [default: auto] [possible values: always, auto, never]
-h, --help Print help
-V, --version Print version
```
### Help for a Specific Algorithm
```shell
$ chksum help sha2-224
Calculate SHA-2 224 digest
Usage: chksum sha2-224 [OPTIONS] <PATH>...
Arguments:
<PATH>... Path to file or directory
Options:
-s, --stdin Calculate digest from stdin
-c, --color <COLOR> Show colored output [default: auto] [possible values: always, auto, never]
-h, --help Print help
```
### File Processing
```shell
$ chksum sha2-224 LICENSE
LICENSE: 99258bca0d23c69388dd53412f1009132753b89459359a401a6ed158
```
### Directory Processing
```shell
$ chksum sha1 src/
src/: 03e4ae615c034f5db47c72bd5c6c9e5bf450a2bd
```
### Standard Input Processing
```shell
```
## Library
Check out the [`chksum`](https://github.com/chksum-rs/lib) crate to see the library that allows you to calculate digests of files and directories with an easy-to-use interface.
## Hash Algorithms
This binary provides implementations for the following 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)
## Features
### Algorithms
* `md5`: Enables MD5 hash algorithm.
* `sha1`: Enables SHA-1 hash algorithm.
* `sha2`: Enables SHA-2 hash family algorithms.
* `sha2-224`: Enables only SHA-2 224 hash algorithm.
* `sha2-256`: Enables only SHA-2 256 hash algorithm.
* `sha2-384`: Enables only SHA-2 384 hash algorithm.
* `sha2-512`: Enables only SHA-2 512 hash algorithm.
By default, all of them are enabled.
### Extra Options
* `color`: Enables colored output.
By default, all of them are enabled.
## Disclaimer
The code is under development, and the interface may change in the future.
## License
This crate is licensed under the MIT License.