Skip to content

Commit

Permalink
chore: use mod.nr files in stdlib (#5379)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Followup to #5039 

## Summary\*

This PR pushes all `hash.nr` into the `hash` directory as a `mod.nr`
file, etc.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench authored Jul 2, 2024
1 parent 9501495 commit b000598
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ curve you want to use, which would be specified using any one of the methods
`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the
defining equation together with a generator point as parameters. You can find more detail in the
comments in
[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but
[`noir_stdlib/src/ec/mod.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec/mod.nr), but
the gist of it is that the elliptic curves of interest are usually expressed in one of the standard
forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that,
you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly
Expand Down Expand Up @@ -67,7 +67,7 @@ does indeed lie on `c` by calling `c.contains(p1)`.
the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where
`z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to
satisfy are specified in the comments
[here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)).
[here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec/mod.nr)).

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx';
Given an array of bytes, returns the resulting sha256 hash.
Specify a message_size to hash only the first `message_size` bytes of the input.

#include_code sha256 noir_stdlib/src/hash.nr rust
#include_code sha256 noir_stdlib/src/hash/mod.nr rust

example:
#include_code sha256_var test_programs/execution_success/sha256/src/main.nr rust
Expand All @@ -34,7 +34,7 @@ fn main() {

Given an array of bytes, returns an array with the Blake2 hash

#include_code blake2s noir_stdlib/src/hash.nr rust
#include_code blake2s noir_stdlib/src/hash/mod.nr rust

example:

Expand All @@ -51,7 +51,7 @@ fn main() {

Given an array of bytes, returns an array with the Blake3 hash

#include_code blake3 noir_stdlib/src/hash.nr rust
#include_code blake3 noir_stdlib/src/hash/mod.nr rust

example:

Expand All @@ -68,7 +68,7 @@ fn main() {

Given an array of Fields, returns the Pedersen hash.

#include_code pedersen_hash noir_stdlib/src/hash.nr rust
#include_code pedersen_hash noir_stdlib/src/hash/mod.nr rust

example:

Expand All @@ -80,7 +80,7 @@ example:

Given an array of Fields, returns the Pedersen commitment.

#include_code pedersen_commitment noir_stdlib/src/hash.nr rust
#include_code pedersen_commitment noir_stdlib/src/hash/mod.nr rust

example:

Expand All @@ -94,7 +94,7 @@ Given an array of bytes (`u8`), returns the resulting keccak hash as an array of
32 bytes (`[u8; 32]`). Specify a message_size to hash only the first
`message_size` bytes of the input.

#include_code keccak256 noir_stdlib/src/hash.nr rust
#include_code keccak256 noir_stdlib/src/hash/mod.nr rust

example:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b000598

Please sign in to comment.