#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

#229 in Cryptography

Download history 29845/week @ 2024-07-19 34694/week @ 2024-07-26 34997/week @ 2024-08-02 32837/week @ 2024-08-09 33708/week @ 2024-08-16 37972/week @ 2024-08-23 49363/week @ 2024-08-30 47469/week @ 2024-09-06 41994/week @ 2024-09-13 44324/week @ 2024-09-20 42665/week @ 2024-09-27 31546/week @ 2024-10-04 39544/week @ 2024-10-11 46952/week @ 2024-10-18 45116/week @ 2024-10-25 43816/week @ 2024-11-01

181,130 downloads per month
Used in 145 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