Skip to content

Commit

Permalink
Expose sponge function for other users (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbruestle authored Aug 17, 2024
1 parent 7f50b8a commit 39fb52b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions zirgen/compiler/zkp/poseidon2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ Digest poseidon2HashPair(Digest x, Digest y) {
return out;
}

void poseidonSponge(std::array<uint32_t, 24>& cells) {
cells = poseidon2_mix(cells);
}

Poseidon2Rng::Poseidon2Rng() : pool_used(0) {
for (size_t i = 0; i < CELLS; i++) {
cells[i] = 0;
Expand Down
4 changes: 4 additions & 0 deletions zirgen/compiler/zkp/poseidon2.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@

namespace zirgen {

// Hashing functions used by the proof system itself
Digest poseidon2Hash(const uint32_t* data, size_t size);
Digest poseidon2HashPair(Digest x, Digest y);

// Raw access to inner poseidon sponge function
void poseidonSponge(std::array<uint32_t, 24>& cells);

class Poseidon2Rng : public IopRng {
public:
Poseidon2Rng();
Expand Down

0 comments on commit 39fb52b

Please sign in to comment.