#sha-1 #digest #const #hash #context #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

#127 in Cryptography

Download history 19346/week @ 2023-12-23 27451/week @ 2023-12-30 33921/week @ 2024-01-06 31887/week @ 2024-01-13 32364/week @ 2024-01-20 36193/week @ 2024-01-27 35523/week @ 2024-02-03 38345/week @ 2024-02-10 36455/week @ 2024-02-17 29483/week @ 2024-02-24 30531/week @ 2024-03-02 33764/week @ 2024-03-09 30595/week @ 2024-03-16 31656/week @ 2024-03-23 30961/week @ 2024-03-30 25478/week @ 2024-04-06

124,340 downloads per month
Used in 143 crates (13 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