Skip to content

Commit

Permalink
refactor: move to its own crate
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Mar 4, 2024
1 parent 19f7b48 commit 6b286b6
Show file tree
Hide file tree
Showing 21 changed files with 706 additions and 143 deletions.
155 changes: 155 additions & 0 deletions .github/workflows/sha1-checked.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: sha1

on:
pull_request:
paths:
- ".github/workflows/sha1-checked.yml"
- "sha1-checked/**"
- "Cargo.*"
push:
branches: master

defaults:
run:
working-directory: sha1-checked

env:
RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 0

jobs:
set-msrv:
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
with:
msrv: 1.72.0

# Builds for no_std platforms
build:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
- loongarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cargo-hack-install@master
- run: cargo hack build --target ${{ matrix.target }} --each-feature --exclude-features default,std

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}

# Linux tests
linux:
needs: set-msrv
strategy:
matrix:
include:
# 32-bit Linux/x86
#- target: i686-unknown-linux-gnu
# rust: ${{needs.set-msrv.outputs.msrv}}
# deps: sudo apt update && sudo apt install gcc-multilib
#- target: i686-unknown-linux-gnu
# rust: stable
# deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux/x86_64
- target: x86_64-unknown-linux-gnu
rust: ${{needs.set-msrv.outputs.msrv}}
- target: x86_64-unknown-linux-gnu
rust: stable

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cargo-hack-install@master
- run: ${{ matrix.deps }}
- run: cargo hack test --feature-powerset

# macOS tests
macos:
needs: set-msrv
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable

runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: x86_64-apple-darwin
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --all-features

# Windows tests
windows:
needs: set-msrv
strategy:
matrix:
include:
# 64-bit Windows (GNU)
- target: x86_64-pc-windows-gnu
toolchain: ${{needs.set-msrv.outputs.msrv}}
- target: x86_64-pc-windows-gnu
toolchain: stable

runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
- uses: msys2/setup-msys2@v2
- run: cargo test --target ${{ matrix.target }}

# Cross-compiled tests
cross:
strategy:
matrix:
rust:
- 1.72.0
- stable
target:
- aarch64-unknown-linux-gnu
- powerpc-unknown-linux-gnu
features:
- default

runs-on: ubuntu-latest
defaults:
run:
# Cross mounts only current package, i.e. by default it ignores workspace's Cargo.toml
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-tests
with:
rust: ${{ matrix.rust }}
package: ${{ github.workflow }}
target: ${{ matrix.target }}
features: ${{ matrix.features }}
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ members = [
"md5",
"ripemd",
"sha1",
"sha1-checked",
"sha2",
"sha3",
"shabal",
Expand Down
8 changes: 8 additions & 0 deletions sha1-checked/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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).

## UNRELEASED
32 changes: 32 additions & 0 deletions sha1-checked/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "sha1-checked"
version = "0.11.0-pre.3"
description = "SHA-1 hash function with collision detection"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2021"
documentation = "https://docs.rs/sha1-checked"
repository = "https://github.com/RustCrypto/hashes"
keywords = ["crypto", "sha1", "hash", "digest"]
categories = ["cryptography", "no-std"]
rust-version = "1.72"

[dependencies]
digest = "=0.11.0-pre.8"
sha1 = { version = "=0.11.0-pre.3", features = [], path = "../sha1" }

[dev-dependencies]
digest = { version = "=0.11.0-pre.8", features = ["dev"] }
hex-literal = "0.4"

[features]
default = ["oid", "std"]
std = ["digest/std", "sha1/std"]
oid = ["digest/oid", "sha1/oid"] # Enable OID support
zeroize = ["digest/zeroize", "sha1/zeroize"]


[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Loading

0 comments on commit 6b286b6

Please sign in to comment.