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

Consider changing padding rule for RPX #203

Closed
Tracked by #194
bobbinth opened this issue Oct 27, 2023 · 1 comment · Fixed by #236
Closed
Tracked by #194

Consider changing padding rule for RPX #203

bobbinth opened this issue Oct 27, 2023 · 1 comment · Fixed by #236
Assignees
Milestone

Comments

@bobbinth
Copy link
Contributor

bobbinth commented Oct 27, 2023

Currently, padding rule for RPX is the same as for RPO, which works as follows:

  • If the number of input elements to is divisible by 8, the first capacity register is initialized to 0.
  • If the number of input elements is not divisible by 8, the first capacity register is initialized to 1, and the input is padded with 1 and some number of 0's needed to make the total input length divisible by 8.

An alternative approach could work as follows:

  • Always initialize the first capacity register by $n \mod 8$ where $n$ is the number of input elements.

The downside of this approach is that we degrade the security a little (by 3 bits?).

The benefit is that hashing long strings of elements becomes easier in the VM. For example, by doing u32divmod.8 swap add.1 we can compute both the value to initialize the capacity register to and the number of absorption steps we need to perform for a string of a given length.

One potential issue to consider is that an empty string and a string of 8 zeros will hash to the same value - but this is the case for RPO as well.

@bobbinth bobbinth added this to the v0.8 milestone Jan 5, 2024
@bobbinth bobbinth linked a pull request Jan 17, 2024 that will close this issue
@bobbinth
Copy link
Contributor Author

Closed by #236.

@github-project-automation github-project-automation bot moved this from Todo to Done in Builder's testnet Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants