Skip to content

Conversation

TomerStarkware
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TomerStarkware TomerStarkware marked this pull request as ready for review September 2, 2025 13:29
@TomerStarkware TomerStarkware force-pushed the tomer/09-02-optimized_sha256_bytearray branch from e34c042 to 5f734b5 Compare September 2, 2025 13:31
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @giladchase)


corelib/src/sha256.cairo line 86 at r1 (raw file):

/// ```
pub fn compute_sha256_byte_array(arr: @ByteArray) -> [u32; 8] {
    let mut span = Span { snapshot: arr.data };

Suggestion:

    let mut span = arr.data.span();

corelib/src/sha256.cairo line 90 at r1 (raw file):

    let mut words_arr = array![];
    let mut last_word = 0;
    let mut last_word_len = 0;

Suggestion:

    let mut last_word_len: BoundedInt::<0, 3> = 0;

corelib/src/sha256.cairo line 102 at r1 (raw file):

        let mut shift = *arr.pending_word_len - BYTES_IN_U128 + last_word_len;
        if shift >= 4 {
            shift = shift - 4;

Suggestion:

        let mut shift = *arr.pending_word_len - BYTES_IN_U128 + last_word_len;
        if let Some(shift) = shift.checked_sub(4) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants