#const-context #sha-1 #hash-digest #evaluated #useable

no-std const-sha1

A sha1 implementation for use in const contexts

4 releases (2 breaking)

0.3.0 Jan 3, 2024
0.2.0 Jul 22, 2020
0.1.1 Jul 17, 2020
0.1.0 Jun 29, 2020

#172 in Cryptography

Download history 29375/week @ 2023-11-21 26583/week @ 2023-11-28 28806/week @ 2023-12-05 34170/week @ 2023-12-12 29407/week @ 2023-12-19 18564/week @ 2023-12-26 32378/week @ 2024-01-02 31837/week @ 2024-01-09 33235/week @ 2024-01-16 31972/week @ 2024-01-23 36689/week @ 2024-01-30 37369/week @ 2024-02-06 35778/week @ 2024-02-13 37494/week @ 2024-02-20 27570/week @ 2024-02-27 25739/week @ 2024-03-05

134,672 downloads per month
Used in 120 crates (6 directly)

Apache-2.0/MIT

22KB
465 lines

crates.io docs.rs Build and Test

const-sha1

A sha1 implementation useable in const contexts.

Use

const fn signature() -> [u32; 5] {
    const_sha1::sha1(stringify!(MyType).as_bytes()).data
}

Minimum Supported Rust Version (MSRV)

This crate requires Rust 1.46.0 or newer due to the use of some const expression features.

No-std

const-sha1 = { version = "0.2.0", default-features = false }

Attribution

This code is largely inspired by the following repos:


lib.rs:

A const evaluated sha1 function.

Use

const fn signature() -> const_sha1::Digest {
    const_sha1::sha1(stringify!(MyType).as_bytes())
}

No runtime deps

Features