tlsn_core/transcript/
hash.rs1use serde::{Deserialize, Serialize};
4
5use crate::{
6 hash::{Blinder, HashAlgId, HashAlgorithm, TypedHash},
7 transcript::{Direction, Idx},
8};
9
10pub fn hash_plaintext(hasher: &dyn HashAlgorithm, msg: &[u8], blinder: &Blinder) -> TypedHash {
14 TypedHash {
15 alg: hasher.id(),
16 value: hasher.hash_prefixed(msg, blinder.as_bytes()),
17 }
18}
19
20#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
22pub struct PlaintextHash {
23 pub direction: Direction,
25 pub idx: Idx,
27 pub hash: TypedHash,
29}
30
31#[derive(Clone, Serialize, Deserialize)]
33pub struct PlaintextHashSecret {
34 pub direction: Direction,
36 pub idx: Idx,
38 pub alg: HashAlgId,
40 pub blinder: Blinder,
42}
43
44opaque_debug::implement!(PlaintextHashSecret);