#sha-1 #digest #hash #const

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

#221 in Cryptography

Download history 33968/week @ 2024-08-13 34026/week @ 2024-08-20 42953/week @ 2024-08-27 49996/week @ 2024-09-03 46064/week @ 2024-09-10 41630/week @ 2024-09-17 43545/week @ 2024-09-24 39128/week @ 2024-10-01 31000/week @ 2024-10-08 47027/week @ 2024-10-15 45470/week @ 2024-10-22 44895/week @ 2024-10-29 42108/week @ 2024-11-05 40855/week @ 2024-11-12 45160/week @ 2024-11-19 42540/week @ 2024-11-26

179,614 downloads per month
Used in 146 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