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

Change pedersen hash functions in the stdlib to return a Pedersen struct #3161

Closed
kevaundray opened this issue Oct 14, 2023 · 0 comments · Fixed by #3190
Closed

Change pedersen hash functions in the stdlib to return a Pedersen struct #3161

kevaundray opened this issue Oct 14, 2023 · 0 comments · Fixed by #3190
Assignees
Labels
enhancement New feature or request

Comments

@kevaundray
Copy link
Contributor

kevaundray commented Oct 14, 2023

Problem

Currently users need to write code that looks like this:

let x = dep::std::hash::pedersen_with_separator([a,b,c],value)[0];

Writing [0] to get the x value hurts readability.

Happy Case

We can create a struct like so:

struct PedersenPoint {
   x : Field,
   y : Field,
}

Then change pedersen_with_separator to be named __pedersen_with_separator while the pub keyword is not in full effect yet.

Then have pedersen_with_seperator look something like:

fn pedersen_with_separator(...) -> PedersenPoint{
  let values = __pedersen_with_separator(...);
  PedersenPoint {
     x: values[0],
     y: values[1],
  }
}

The result would then be:

let x = dep::std::hash::pedersen_with_separator([a,b,c],value).x;

Alternatives Considered

No response

Additional Context

This is a breaking change

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@kevaundray kevaundray added the enhancement New feature or request label Oct 14, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Oct 14, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants