-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Blake2s hints (Part 2) (#312)
* Begin implemneting blake2s * Finish blake2s impl * Add unit test * Add more unit tests * Add integration test * Implement BLAKE2S_COMPUTE * Add unit tests * Add unit tests * Add newline * Add integration test * Implement BLAKE2S_ADD_UINT256_BIGEND hint * Add unit test * Add integration test * Implement finalize_blake2s hint * Fix removed line * Add unit test * Fix test values --------- Co-authored-by: toni-calvin <[email protected]>
- Loading branch information
1 parent
c58f01e
commit f08fbfd
Showing
7 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
%builtins range_check bitwise | ||
|
||
from starkware.cairo.common.bool import TRUE | ||
from starkware.cairo.common.alloc import alloc | ||
from starkware.cairo.common.cairo_blake2s.blake2s import blake2s_felts | ||
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin | ||
|
||
func main{range_check_ptr, bitwise_ptr: BitwiseBuiltin*}() { | ||
alloc_locals; | ||
let inputs: felt* = alloc(); | ||
assert inputs[0] = 3456722; | ||
assert inputs[1] = 435425528; | ||
assert inputs[2] = 3232553; | ||
assert inputs[3] = 2576195; | ||
assert inputs[4] = 73471943; | ||
assert inputs[5] = 17549868; | ||
assert inputs[6] = 87158958; | ||
assert inputs[7] = 6353668; | ||
assert inputs[8] = 343656565; | ||
assert inputs[9] = 1255962; | ||
assert inputs[10] = 25439785; | ||
assert inputs[11] = 1154578; | ||
assert inputs[12] = 585849303; | ||
assert inputs[13] = 763502; | ||
assert inputs[14] = 43753647; | ||
assert inputs[15] = 74256930; | ||
let (local blake2s_ptr_start) = alloc(); | ||
let blake2s_ptr = blake2s_ptr_start; | ||
let (result) = blake2s_felts{range_check_ptr=range_check_ptr, blake2s_ptr=blake2s_ptr}( | ||
16, inputs, TRUE | ||
); | ||
assert result.low = 23022179997536219430502258022509199703; | ||
assert result.high = 136831746058902715979837770794974289597; | ||
return (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
%builtins range_check bitwise | ||
|
||
from starkware.cairo.common.alloc import alloc | ||
from starkware.cairo.common.cairo_blake2s.blake2s import blake2s, finalize_blake2s | ||
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin | ||
|
||
func main{range_check_ptr, bitwise_ptr: BitwiseBuiltin*}() { | ||
alloc_locals; | ||
let inputs: felt* = alloc(); | ||
assert inputs[0] = 'Hell'; | ||
assert inputs[1] = 'o Wo'; | ||
assert inputs[2] = 'rld'; | ||
let (local blake2s_ptr_start) = alloc(); | ||
let blake2s_ptr = blake2s_ptr_start; | ||
let (output) = blake2s{range_check_ptr=range_check_ptr, blake2s_ptr=blake2s_ptr}(inputs, 9); | ||
finalize_blake2s(blake2s_ptr_start, blake2s_ptr); | ||
return (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters