#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

#290 in Cryptography

Download history 43684/week @ 2024-11-15 49840/week @ 2024-11-22 54427/week @ 2024-11-29 55549/week @ 2024-12-06 53248/week @ 2024-12-13 29096/week @ 2024-12-20 27412/week @ 2024-12-27 45952/week @ 2025-01-03 49819/week @ 2025-01-10 51492/week @ 2025-01-17 54727/week @ 2025-01-24 57040/week @ 2025-01-31 54977/week @ 2025-02-07 53322/week @ 2025-02-14 57945/week @ 2025-02-21 53655/week @ 2025-02-28

228,595 downloads per month
Used in 148 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