Skip to content

Commit

Permalink
Add test file
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Sep 19, 2023
1 parent 2da342e commit 96137fb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cairo_programs/unsafe_keccak_finalize.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
%builtins output

from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.serialize import serialize_word
from starkware.cairo.common.keccak import unsafe_keccak_finalize, KeccakState
from starkware.cairo.common.uint256 import Uint256

func main{output_ptr: felt*}() {
alloc_locals;

let (data: felt*) = alloc();

assert data[0] = 0;
assert data[1] = 1;
assert data[2] = 2;

let keccak_state = KeccakState(start_ptr=data, end_ptr=data + 2);

let res: Uint256 = unsafe_keccak_finalize(keccak_state);

assert res.low = 17219183504112405672555532996650339574;
assert res.high = 235346966651632113557018504892503714354;

serialize_word(res.low);
serialize_word(res.high);

return ();
}

0 comments on commit 96137fb

Please sign in to comment.