-
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 8579d24
Showing
12 changed files
with
1,323 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,47 @@ | ||
# chksum-sha2-224 | ||
|
||
[![GitHub](https://img.shields.io/badge/github-chksum--rs%2Fsha2--224-24292e?style=flat-square&logo=github "GitHub")](https://github.com/chksum-rs/sha2-224) | ||
[![Build](https://img.shields.io/github/actions/workflow/status/chksum-rs/sha2-224/rust.yml?branch=master&style=flat-square&logo=github "Build")](https://github.com/chksum-rs/sha2-224/actions/workflows/rust.yml) | ||
[![docs.rs](https://img.shields.io/docsrs/chksum-sha2-224?style=flat-square&logo=docsdotrs "docs.rs")](https://docs.rs/chksum-sha2-224/) | ||
[![MSRV](https://img.shields.io/badge/MSRV-1.70.0-informational?style=flat-square "MSRV")](https://github.com/chksum-rs/sha2-224/blob/master/Cargo.toml) | ||
[![deps.rs](https://deps.rs/crate/chksum-sha2-224/0.0.0/status.svg?style=flat-square "deps.rs")](https://deps.rs/crate/chksum-sha2-224/0.0.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/chksum-rs/sha2-224?style=flat-square "LICENSE")](https://github.com/chksum-rs/sha2-224/blob/master/LICENSE) | ||
|
||
An implementation of the SHA-2 224 hash function with a straightforward interface for computing digests of bytes, files, directories, and more. | ||
|
||
## Setup | ||
|
||
To use this crate, add the following entry to your `Cargo.toml` file in the `dependencies` section: | ||
|
||
```toml | ||
[dependencies] | ||
chksum-sha2-224 = "0.0.0" | ||
``` | ||
|
||
Alternatively, you can use the [`cargo add`](https://doc.rust-lang.org/cargo/commands/cargo-add.html) subcommand: | ||
|
||
```shell | ||
cargo add chksum-sha2-224 | ||
``` | ||
|
||
## Usage | ||
|
||
Use the `chksum` function to calcualate digest of file, directory and so on. | ||
|
||
```rust | ||
use chksum_sha2_224 as sha2_224; | ||
|
||
let file = File::open(path)?; | ||
let digest = sha2_224::chksum(file)?; | ||
assert_eq!( | ||
digest.to_hex_lowercase(), | ||
"90382cbfda2656313ad61fd74b32ddfa4bcc118f660bd4fba9228ced" | ||
); | ||
``` | ||
|
||
For more usage examples, refer to the documentation available at [docs.rs](https://docs.rs/chksum-sha2-224/). | ||
|
||
## License | ||
|
||
This crate is licensed under the MIT License. |
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,141 @@ | ||
name: Rust | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- ".github/workflows/*.yml" | ||
- "Cargo.toml" | ||
- "src/**.rs" | ||
- "tests/**.rs" | ||
pull_request: | ||
branches: | ||
- master | ||
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 | ||
|
||
build-and-test-linux: | ||
needs: | ||
- lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [1.70.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: | ||
- lint | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [1.70.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: | ||
- lint | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [1.70.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 |
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,3 @@ | ||
# Cargo | ||
Cargo.lock | ||
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.0.0] - 2023-12-21 | ||
|
||
### Added | ||
|
||
- Initial release. | ||
|
||
[0.0.0]: https://github.com/chksum-rs/sha2-224/releases/tag/v0.0.0 |
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,31 @@ | ||
[package] | ||
name = "chksum-sha2-224" | ||
version = "0.0.0" | ||
authors = ["Konrad Goławski <[email protected]>"] | ||
edition = "2021" | ||
rust-version = "1.70.0" | ||
description = "An implementation of the SHA-2 224 hash function with a straightforward interface for computing digests of bytes, files, directories, and more." | ||
readme = ".cargo/README.md" | ||
repository = "https://github.com/chksum-rs/sha2-224" | ||
license = "MIT" | ||
keywords = ["checksum", "digest", "hash", "sha224", "sha2-224"] | ||
categories = ["algorithms", "cryptography", "filesystem"] | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[dependencies] | ||
chksum-core = "0.0.0" | ||
chksum-hash-sha2-224 = "0.0.0" | ||
chksum-reader = { version = "0.0.0", optional = true } | ||
chksum-writer = { version = "0.0.0", optional = true } | ||
|
||
[dev-dependencies] | ||
assert_fs = { version = "1.0.13", features = ["color-auto"] } | ||
thiserror = "1.0.51" | ||
|
||
[features] | ||
default = [] | ||
reader = ["chksum-reader"] | ||
writer = ["chksum-writer"] |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Konrad Goławski | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, 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 THE | ||
SOFTWARE. |
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,47 @@ | ||
# chksum-sha2-224 | ||
|
||
[![crates.io](https://img.shields.io/crates/v/chksum-sha2-224?style=flat-square&logo=rust "crates.io")](https://crates.io/crates/chksum-sha2-224) | ||
[![Build](https://img.shields.io/github/actions/workflow/status/chksum-rs/sha2-224/rust.yml?branch=master&style=flat-square&logo=github "Build")](https://github.com/chksum-rs/sha2-224/actions/workflows/rust.yml) | ||
[![docs.rs](https://img.shields.io/docsrs/chksum-sha2-224?style=flat-square&logo=docsdotrs "docs.rs")](https://docs.rs/chksum-sha2-224/) | ||
[![MSRV](https://img.shields.io/badge/MSRV-1.70.0-informational?style=flat-square "MSRV")](https://github.com/chksum-rs/sha2-224/blob/master/Cargo.toml) | ||
[![deps.rs](https://deps.rs/crate/chksum-sha2-224/0.0.0/status.svg?style=flat-square "deps.rs")](https://deps.rs/crate/chksum-sha2-224/0.0.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/chksum-rs/sha2-224?style=flat-square "LICENSE")](https://github.com/chksum-rs/sha2-224/blob/master/LICENSE) | ||
|
||
An implementation of the SHA-2 224 hash function with a straightforward interface for computing digests of bytes, files, directories, and more. | ||
|
||
## Setup | ||
|
||
To use this crate, add the following entry to your `Cargo.toml` file in the `dependencies` section: | ||
|
||
```toml | ||
[dependencies] | ||
chksum-sha2-224 = "0.0.0" | ||
``` | ||
|
||
Alternatively, you can use the [`cargo add`](https://doc.rust-lang.org/cargo/commands/cargo-add.html) subcommand: | ||
|
||
```shell | ||
cargo add chksum-sha2-224 | ||
``` | ||
|
||
## Usage | ||
|
||
Use the `chksum` function to calcualate digest of file, directory and so on. | ||
|
||
```rust | ||
use chksum_sha2_224 as sha2_224; | ||
|
||
let file = File::open(path)?; | ||
let digest = sha2_224::chksum(file)?; | ||
assert_eq!( | ||
digest.to_hex_lowercase(), | ||
"90382cbfda2656313ad61fd74b32ddfa4bcc118f660bd4fba9228ced" | ||
); | ||
``` | ||
|
||
For more usage examples, refer to the documentation available at [docs.rs](https://docs.rs/chksum-sha2-224/). | ||
|
||
## License | ||
|
||
This crate is licensed under the MIT License. |
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,17 @@ | ||
combine_control_expr = false | ||
edition = "2021" | ||
force_multiline_blocks = true | ||
format_code_in_doc_comments = true | ||
format_generated_files = true | ||
format_strings = true | ||
group_imports = "StdExternalCrate" | ||
hex_literal_case = "Upper" | ||
imports_granularity = "Module" | ||
imports_layout = "HorizontalVertical" | ||
match_block_trailing_comma = true | ||
max_width = 120 | ||
normalize_comments = true | ||
normalize_doc_attributes = true | ||
reorder_impl_items = true | ||
use_field_init_shorthand = true | ||
use_try_shorthand = true |
Oops, something went wrong.