-
Notifications
You must be signed in to change notification settings - Fork 23
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
Optimizations #136
Merged
Merged
Optimizations #136
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
34d498a
Use divrem in rotr functions
fmkra 14c7ca6
Sigma calculation optimization
fmkra dec1541
Use felts where possible
fmkra 3062e84
Inline rotr functions
fmkra b5fdd06
Fmt
fmkra 51b355a
Fix comment break
fmkra 713e210
Revert to scarb 2.6.3
fmkra 555dfc0
Fmt
fmkra 93cd49b
Fmt
fmkra 1f0cdab
public input hash test
Okm165 2127f9e
cairo0_example_proof_blake2s
Okm165 93f0da3
Merge branch 'main' into optimizations
fmkra b508f65
Fix public input test
fmkra 2944624
Fmt
fmkra 231291b
ducking formatting
fmkra d82e2c6
I gonna loose my mind
fmkra 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,21 +52,26 @@ fn get_sigma(r: u32) -> Array<u32> { | |
} | ||
|
||
fn rotr16(n: u32) -> u32 { | ||
n / 65536 + (n % 65536) * 65536 | ||
let (high, low) = DivRem::div_rem(n, 65536); | ||
high + (low % 65536) * 65536 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The % shouldn't be needed |
||
} | ||
|
||
fn rotr12(n: u32) -> u32 { | ||
n / 4096 + (n % 4096) * 1048576 | ||
let (high, low) = DivRem::div_rem(n, 4096); | ||
high + low * 1048576 | ||
} | ||
|
||
fn rotr8(n: u32) -> u32 { | ||
n / 256 + (n % 256) * 16777216 | ||
let (high, low) = DivRem::div_rem(n, 256); | ||
high + low * 16777216 | ||
} | ||
|
||
fn rotr7(n: u32) -> u32 { | ||
n / 128 + (n % 128) * 33554432 | ||
let (high, low) = DivRem::div_rem(n, 128); | ||
high + low * 33554432 | ||
} | ||
|
||
|
||
#[derive(Drop, Clone)] | ||
struct blake2s_state { | ||
h: Array<u32>, // length: 8 | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The % shouldn't be needed