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

CPU poseidon hash #611

Open
wants to merge 234 commits into
base: main
Choose a base branch
from
Open

CPU poseidon hash #611

wants to merge 234 commits into from

Conversation

danny-shterman
Copy link

Describe the changes

This PR for CPU Poseidon hash (single hash and multiple hashes).

Linked Issues

Resolves #

const unsigned int nof_partial_rounds,
const unsigned int nof_upper_full_rounds,
const unsigned int nof_end_full_rounds,
const S* rounds_constants,
Copy link
Contributor

Choose a reason for hiding this comment

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

if you provide 4 arrays, why do you need the struct PoseidonConstants?

Copy link
Author

Choose a reason for hiding this comment

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

You wanted to put all matrices and round consts in a structure

const unsigned int m_nof_partial_rounds; ///< Partial number of rounds of this Poseidon hash.
const unsigned int m_nof_upper_full_rounds; ///< Number of full rounds at the beginning of this Poseidon hash.
const unsigned int m_nof_end_full_rounds; ///< Number of full rounds at the end of this Poseidon hash.
PoseidonConstants<S> m_poseidon_constants; ///< Structure that holds Poseidon hash round constants and MDS matrix values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it going to be more comfortable to just save the 4 vectors instead of this class?

Copy link
Author

Choose a reason for hiding this comment

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

What do you mean? What class?

tmp_col_res[col_idx] = tmp_col_res[col_idx] + vec_in[row_idx] * matrix_in[row_idx * arity + col_idx];
}
}
for (int col_idx = 0; col_idx < arity; col_idx++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can avoid this copy

@mickeyasa
Copy link
Contributor

comment

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.

6 participants