-
Notifications
You must be signed in to change notification settings - Fork 387
fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block #5760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c21a619
switch to asserting message size is less than the actual message size…
vezenovm 0caa360
nargo fmt hte stdlib and new func
vezenovm cabc824
remove no_pred on msg u8 to u32
vezenovm 865cd64
add test for issue 5761 regression
vezenovm 0c56e6c
update regression size test to go under predicates and also remove as…
vezenovm 9e507f6
perform sha256 compression by block not per element of the message
vezenovm 616ee96
delete old sha256
vezenovm 7f8e88d
resolve conflicts w/ master
vezenovm 863ff73
cleanup
vezenovm c5568f4
delelete bug stuff from sha256 test
vezenovm 8f32622
narog fmt
vezenovm 40db230
check if we are in unconstrained runtime sha256
vezenovm 9458cb0
fix increasing msg_byte_ptr for unconstrained
vezenovm 8d201a5
stdlib fmt
vezenovm 60bb4bf
remove old bench debug file
vezenovm 1e574dd
update sha256_var_size_regression test
vezenovm ee7598f
Merge branch 'master' into mv/sha256-var-opt
vezenovm 828a22e
fixup sha256 based off comments
vezenovm 5950f69
Merge branch 'master' into mv/sha256-var-opt
vezenovm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
7 changes: 7 additions & 0 deletions
7
test_programs/execution_success/sha256_var_size_regression/Nargo.toml
This file contains hidden or 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,7 @@ | ||
| [package] | ||
| name = "sha256_var_size_regression" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.33.0" | ||
|
|
||
| [dependencies] |
3 changes: 3 additions & 0 deletions
3
test_programs/execution_success/sha256_var_size_regression/Prover.toml
This file contains hidden or 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,3 @@ | ||
| enable = [true, false] | ||
| foo = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] | ||
| toggle = false |
17 changes: 17 additions & 0 deletions
17
test_programs/execution_success/sha256_var_size_regression/src/main.nr
This file contains hidden or 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,17 @@ | ||
| global NUM_HASHES = 2; | ||
|
|
||
| fn main(foo: [u8; 95], toggle: bool, enable: [bool; NUM_HASHES]) { | ||
| let mut result = [[0; 32]; NUM_HASHES]; | ||
| let mut const_result = [[0; 32]; NUM_HASHES]; | ||
| let size: Field = 93 + toggle as Field * 2; | ||
| for i in 0..NUM_HASHES { | ||
| if enable[i] { | ||
| result[i] = std::sha256::sha256_var(foo, size as u64); | ||
| const_result[i] = std::sha256::sha256_var(foo, 93); | ||
| } | ||
| } | ||
|
|
||
| for i in 0..NUM_HASHES { | ||
| assert_eq(result[i], const_result[i]); | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
test_programs/execution_success/sha256_var_witness_const_regression/Nargo.toml
This file contains hidden or 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,7 @@ | ||
| [package] | ||
| name = "sha256_var_witness_const_regression" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.33.0" | ||
|
|
||
| [dependencies] |
2 changes: 2 additions & 0 deletions
2
test_programs/execution_success/sha256_var_witness_const_regression/Prover.toml
This file contains hidden or 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,2 @@ | ||
| input = [0, 0] | ||
| toggle = false |
9 changes: 9 additions & 0 deletions
9
test_programs/execution_success/sha256_var_witness_const_regression/src/main.nr
This file contains hidden or 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,9 @@ | ||
| fn main(input: [u8; 2], toggle: bool) { | ||
| let size: Field = 1 + toggle as Field; | ||
| assert(!toggle); | ||
|
|
||
| let variable_sha = std::sha256::sha256_var(input, size as u64); | ||
| let constant_sha = std::sha256::sha256_var(input, 1); | ||
|
|
||
| assert_eq(variable_sha, constant_sha); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.