hashing-serializer

Crates.iohashing-serializer
lib.rshashing-serializer
version0.2.0-pre.0
sourcesrc
created_at2024-06-12 16:50:04.132513
updated_at2024-08-01 01:55:33.011628
descriptionSerialize serde-implementing structures directly into a hash
homepage
repositoryhttps://github.com/fjarri/hashing-serializer
max_upload_size
id1269764
size17,041
Bogdan Opanchuk (fjarri)

documentation

README

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();
Commit count: 3

cargo fmt