Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
supragya committed May 3, 2024
1 parent 0008e57 commit c88e373
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [Tho09]poseidon-hash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Each such round consists of the following three sub-steps:
## Reference implementation for magic values
Directory `reference/hadeshash` includes `generate_params_poseidong.sage` for generating values used inside poseidon hasher. We build values for BLS12-381's $F_q$ a.k.a Scalar Field. For this, use:

```bash
```sh
# For generating for BLS12-381 Fq;
# Modulus = `52435875175126190479447740508185965837690552500527637822603658699938581184513`
# In Hex that is `0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFF00000001`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if len(sys.argv) < 8:
print("Usage: <script> <field> <s_box> <field_size> <num_cells> <alpha> <security_level> <modulus_hex>")
print("field = 1 for GF(p)")
print("s_box = 0 for x^alpha, s_box = 1 for x^(-1)")
exit()
exit()

# GF(p), n = 255, t = 3, alpha=5: sage generate_params_poseidon.sage 1 0 255 3 5 128 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
# GF(p), n = 255, t = 5, alpha=5: sage generate_params_poseidon.sage 1 0 255 5 5 128 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
Expand Down
5 changes: 5 additions & 0 deletions [Tho09]poseidon-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ impl PoseidonHasher {
})
}

/// Applies MDS matrix to get a new state
fn apply_mds_matrix(&mut self) {

}

pub fn hash(&self, input: Vec<Fr>) -> Fr {
// We first have to chunk the input into groups of `T` size.

Expand Down

0 comments on commit c88e373

Please sign in to comment.