Skip to content
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

sha256::digest and sha512::digest do not compile #1259

Closed
1 task done
TomAFrench opened this issue Apr 30, 2023 · 3 comments
Closed
1 task done

sha256::digest and sha512::digest do not compile #1259

TomAFrench opened this issue Apr 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@TomAFrench
Copy link
Member

TomAFrench commented Apr 30, 2023

Aim

I'm trying to compile code which uses the sha256 and sha512 implementations we have in the standard library as part of #1258 .

The functions are defined here:
https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/sha256.nr
https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/sha512.nr

Expected behavior

These functions should compile correctly and calculate the sha256 and sha512 hashes respectively.

Bug

Compilation of these functions fails with the error

error: index out of bounds
    ┌─ std/sha256.nr:151:23
    │
151 │             msg_block[i] = 0;
    │                       - out of bounds error, index is 64 but length is 64

To reproduce

  1. Run the sha2_byte test case
  2. observe error message

Note that all the test cases related to these functions are excluded from the noir integration tests. We don't run this code in the sha256 test case as this uses the native implementation from bberg rather than in noir.

Installation method

Binary

Nargo version

nargo 0.5.0 (git version hash: 5cf7580, is dirty: false)

Additional context

No response

Submission Checklist

  • Once I hit submit, I will assign this issue to the Project Board with the appropriate tags.
@TomAFrench TomAFrench added the bug Something isn't working label Apr 30, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Apr 30, 2023
@TomAFrench
Copy link
Member Author

From the look of the error message this isn't an issue in the actual implementation but in Noir itself. We're trying to write past the end of the array but the surrounding if statement should prevent this.

@kevaundray
Copy link
Contributor

Whats the status of this issue @TomFrench ?

@kevaundray
Copy link
Contributor

Since #1629 has been fixed in the new ssa, closing. Feel free to open if you find that this issue still persists

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants