Skip to content

Commit

Permalink
fix: Bugfix for Keccak opcode related to reading bytes from input (#6989
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jeanmon authored Jun 10, 2024
1 parent a9688f0 commit 5713f4e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ std::array<uint64_t, 25> AvmKeccakTraceBuilder::keccakf1600(uint32_t clk, std::a

std::array<uint8_t, 32> AvmKeccakTraceBuilder::keccak(uint32_t clk, std::vector<uint8_t> input, uint32_t size)
{
// Pad input to a multiple of 8 bytes
if (!input.empty()) {
input.resize(8 * ((input.size() - 1) / 8 + 1));
}

// We treat the input vector as an array of 64-bit integers for the avm (even though keccak takes in bytes).
std::vector<uint64_t> vector_input;
for (size_t i = 0; i < input.size(); i += 4) {
for (size_t i = 0; i < input.size(); i += 8) {
auto uint64 = from_buffer<uint64_t>(input, i);
vector_input.push_back(uint64);
}
Expand Down

0 comments on commit 5713f4e

Please sign in to comment.