MCPcopy Create free account
hub / github.com/docknetwork/crypto / hash_to_field

Function hash_to_field

oblivious_transfer/src/zero_sharing.rs:145–158  ·  view source on GitHub ↗
(
    party_1: ParticipantId,
    party_2: ParticipantId,
    r: &F,
    hasher: &DefaultFieldHasher<D>,
)

Source from the content-addressed store, hash-verified

143}
144
145pub fn hash_to_field<F: PrimeField, D: Default + DynDigest + Clone>(
146 party_1: ParticipantId,
147 party_2: ParticipantId,
148 r: &F,
149 hasher: &DefaultFieldHasher<D>,
150) -> F {
151 let mut bytes = vec![];
152 r.serialize_compressed(&mut bytes).unwrap();
153 bytes.push((party_1 & 255) as u8);
154 bytes.push((party_1 >> 8) as u8);
155 bytes.push((party_2 & 255) as u8);
156 bytes.push((party_2 >> 8) as u8);
157 hasher.hash_to_field(&bytes, 1).pop().unwrap()
158}
159
160#[cfg(test)]
161pub mod tests {

Callers 1

compute_zero_sharesMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected