MCPcopy Create free account
hub / github.com/BitVM/BitVM / extern_hash_fp_var

Function extern_hash_fp_var

bitvm/src/chunk/helpers.rs:104–119  ·  view source on GitHub ↗
(fqs: Vec<[u8; 64]>)

Source from the content-addressed store, hash-verified

102 }
103
104 fn extern_hash_fp_var(fqs: Vec<[u8; 64]>) -> [u8; 64] {
105 let mut vs = Vec::new();
106 for fq in fqs {
107 let v = fq.to_vec();
108 vs.extend_from_slice(&v);
109 }
110 let nib_arr: Vec<u8> = vs.clone().into_iter().collect();
111 let p_bytes: Vec<u8> = nib_to_byte_array(&nib_arr);
112
113 let hash_out = blake3::hash(&p_bytes).to_string();
114
115 let hash_out =
116 replace_first_n_with_zero(&hash_out.to_string(), (32 - BLAKE3_HASH_LENGTH) * 2);
117 let res = hex_string_to_nibble_array(&hash_out);
118 res.try_into().unwrap()
119 }
120
121 extern_hash_fp_var(msgs)
122}

Callers 1

extern_hash_nibblesFunction · 0.85

Calls 4

nib_to_byte_arrayFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected