8 unstable releases (3 breaking)
0.4.0 | Oct 29, 2023 |
---|---|
0.3.2 | Oct 27, 2023 |
0.2.1 | Nov 20, 2022 |
0.2.0 | Sep 13, 2022 |
0.1.1 | Sep 11, 2022 |
#22 in #const-fn
101 downloads per month
Used in 3 crates
(via ethprim)
35KB
709 lines
Implementation of Ethereum 32-byte digests for Rust.
This crate provides a Digest
type for representing Ethereum 32-byte digests.
Additionally it includes macros for digest constants, both from hexidecimal
strings, but also by compile-time Keccak-256 hashing inputs. Under the hood,
they are implemented with const fn
and do not use procedural macros.
Usage
Just add a dependency to your Cargo.toml
:
[dependencies]
ethdigest = "*"
For complete documentation checkout docs.rs
.
lib.rs
:
Implementation of Ethereum digest and hashing for Rust.
This crate provides a Digest
type for representing an Ethereum 32-byte
digest as well as various Keccak-256 hashing utilities for computing them.
Macros
There are a couple of exported macros for creating compile-time digest constants:
Under the hood, they are implemented with const fn
and do not use
procedural macros.
Features
- default
std
: Additional integration with Rust standard library types. Notably, this includesstd::error::Error
implementation on theParseDigestError
and conversions fromVec<u8>
. serde
: Serialization traits for theserde
crate. Note that the implementation is very much geared towards JSON serialization withserde_json
.sha3
: Use the Rust Crypto Keccak-256 implementation (provided by thesha3
crate) instead of the built-in one. Note that thekeccak!
macro will always use the built-in Keccak-256 implementation for computing digests, assha3
does not expose aconst fn
API.
Dependencies
~0–435KB