Blake3 Hash data types For U256Data (which is a single BigInteger) we do not hash but return as is BigInt are used to represent groth16 proof
(self)
| 191 | // For U256Data (which is a single BigInteger) we do not hash but return as is |
| 192 | // BigInt are used to represent groth16 proof |
| 193 | pub fn to_hash(self) -> CompressedStateObject { |
| 194 | match self { |
| 195 | DataType::G2EvalData(r) => { |
| 196 | let hash_t = r.hash_t(); |
| 197 | let hash_le = r.hash_le(); |
| 198 | let hash = extern_hash_nibbles(vec![hash_t, hash_le]); |
| 199 | CompressedStateObject::Hash(hash) |
| 200 | } |
| 201 | DataType::Fp6Data(r) => { |
| 202 | let hash = extern_hash_fps( |
| 203 | r.to_base_prime_field_elements() |
| 204 | .collect::<Vec<ark_bn254::Fq>>(), |
| 205 | ); |
| 206 | CompressedStateObject::Hash(hash) |
| 207 | } |
| 208 | DataType::U256Data(f) => CompressedStateObject::U256(f), |
| 209 | DataType::G1Data(r) => { |
| 210 | let hash = extern_hash_fps(vec![r.x, r.y]); |
| 211 | CompressedStateObject::Hash(hash) |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | pub fn output_is_field_element(&self) -> bool { |
| 217 | matches!(self, DataType::U256Data(_)) |