Expand description
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.
Modules
- A
const fn
Keccak-256 implementation.
Macros
- Macro to create Ethereum digest values from string literals that get parsed at compile time. A compiler error will be generated if an invalid digest is specified.
- Macro to create Ethereum digest values for compile-time hashed input.
Structs
- A 32-byte digest.
- A Keccak-256 hasher.
Enums
- Represents an error parsing a digest from a string.