Skip to content

Commit

Permalink
chore: fix pedersen_compress_with_hash_index c_bind function (#3054)
Browse files Browse the repository at this point in the history
- Makes `pedersen_compress_with_hash_index` adhere to the calling
convention of c_bind_new
- eagerly allocate input for now, which is correct but not optimal

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [ ] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [ ] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).

---------

Co-authored-by: Leila Wang <[email protected]>
  • Loading branch information
2 people authored and AztecBot committed Oct 27, 2023
1 parent 932080a commit 2006f41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/crypto/pedersen_commitment/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WASM_EXPORT void pedersen__compress(uint8_t const* inputs_buffer, uint8_t* outpu
barretenberg::fr::serialize_to_buffer(r, output);
}

WASM_EXPORT void pedersen__compress_with_hash_index(uint8_t const* inputs_buffer, uint8_t* output, uint32_t hash_index)
WASM_EXPORT void pedersen__compress_with_hash_index(uint8_t const* inputs_buffer, uint32_t hash_index, uint8_t* output)
{
std::vector<grumpkin::fq> to_compress;
read(inputs_buffer, to_compress);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/barretenberg/crypto/pedersen_commitment/c_bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WASM_EXPORT void pedersen__compress_fields(uint8_t const* left, uint8_t const* r

WASM_EXPORT void pedersen__compress(uint8_t const* inputs_buffer, uint8_t* output);

WASM_EXPORT void pedersen__compress_with_hash_index(uint8_t const* inputs_buffer, uint8_t* output, uint32_t hash_index);
WASM_EXPORT void pedersen__compress_with_hash_index(uint8_t const* inputs_buffer, uint32_t hash_index, uint8_t* output);
WASM_EXPORT void pedersen__commit(uint8_t const* inputs_buffer, uint8_t* output);

WASM_EXPORT void pedersen__buffer_to_field(uint8_t const* data, size_t length, uint8_t* r);

0 comments on commit 2006f41

Please sign in to comment.