#const #sha1 #hash #digest

const-sha1

A sha1 implementation for use in const contexts

3 unstable releases

0.2.0 Jul 22, 2020
0.1.1 Jul 17, 2020
0.1.0 Jun 29, 2020

#484 in Cryptography

Download history 4387/week @ 2022-06-12 8655/week @ 2022-06-19 25495/week @ 2022-06-26 19452/week @ 2022-07-03 23478/week @ 2022-07-10 26474/week @ 2022-07-17 24316/week @ 2022-07-24 28985/week @ 2022-07-31 29145/week @ 2022-08-07 27169/week @ 2022-08-14 27350/week @ 2022-08-21 31143/week @ 2022-08-28 25072/week @ 2022-09-04 30099/week @ 2022-09-11 28515/week @ 2022-09-18 31846/week @ 2022-09-25

117,454 downloads per month
Used in 122 crates (4 directly)

Apache-2.0/MIT

18KB
426 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-beta or newer due to the use of some const expression features.

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(&const_sha1::ConstBuffer::from_slice(stringify!(MyType).as_bytes()))
}

No runtime deps