#digest #hashing #structures #sha-256

no-std hashing-serializer

Serialize serde-implementing structures directly into a hash

3 unstable releases

0.2.0-pre.0 Aug 1, 2024
0.1.1 Jun 12, 2024
0.1.0 Jun 12, 2024

#103 in No standard library

Download history 389/week @ 2024-07-29 252/week @ 2024-08-05 373/week @ 2024-08-12 320/week @ 2024-08-19 353/week @ 2024-08-26 70/week @ 2024-09-02 310/week @ 2024-09-09 440/week @ 2024-09-16 549/week @ 2024-09-23 558/week @ 2024-09-30 175/week @ 2024-10-07 213/week @ 2024-10-14 417/week @ 2024-10-21 216/week @ 2024-10-28 269/week @ 2024-11-04 231/week @ 2024-11-11

1,155 downloads per month
Used in 6 crates (via synedrion)

MIT license

15KB
336 lines

crate Docs License Coverage

An implementation of serde::Serializer serializing directly into a hash digest (anything implementing digest::Update).

use digest::Digest;
use k256::ecdsa::SigningKey;
use rand_core::OsRng;
use serde::Serialize;
use sha2::Sha256;

use hashing_serializer::HashingSerializer;

let sk = SigningKey::random(&mut OsRng);
let vk = sk.verifying_key();

let mut digest = Sha256::new();
let serializer = HashingSerializer { digest: &mut digest };
vk.serialize(serializer).unwrap();

Dependencies

~405–670KB
~16K SLoC