-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
235 additions
and
47 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
7 changes: 7 additions & 0 deletions
7
test_programs/execution_success/sha256_var_size_regression/Nargo.toml
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,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 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 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 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 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 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); | ||
} |