Skip to content

Commit b510d33

Browse files
committed
refactor: use hash bytes instead of hash_u32 for vk
1 parent 393f9a9 commit b510d33

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

aggregation_mode/aggregation_programs/sp1/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl SP1VkAndPubInputs {
1111
pub fn hash(&self) -> [u8; 32] {
1212
let mut hasher = Keccak256::new();
1313
for &word in &self.vk {
14-
hasher.update(word.to_le_bytes());
14+
hasher.update(word.to_be_bytes());
1515
}
1616
hasher.update(&self.public_inputs);
1717
hasher.finalize().into()

aggregation_mode/src/aggregators/sp1_aggregator.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ pub struct SP1ProofWithPubValuesAndElf {
2222
impl SP1ProofWithPubValuesAndElf {
2323
pub fn hash_vk_and_pub_inputs(&self) -> [u8; 32] {
2424
let mut hasher = Keccak256::new();
25-
for &word in &self.vk().hash_u32() {
26-
hasher.update(word.to_le_bytes());
27-
}
25+
let vk_bytes = &self.vk().hash_bytes();
26+
hasher.update(vk_bytes);
2827
hasher.update(self.proof_with_pub_values.public_values.as_slice());
2928
hasher.finalize().into()
3029
}

0 commit comments

Comments
 (0)