Skip to content

Latest commit

 

History

History
797 lines (790 loc) · 21 KB

CUSTOM_FIELD_T.md

File metadata and controls

797 lines (790 loc) · 21 KB

How to use with other prime fields/t values

  1. First lookup the constants for your desired prime field and t value (state size) here https://github.com/HorizenLabs/poseidon2/tree/main/plain_implementations/src/poseidon2.
  2. If the constants for your prime field/t have not already been precomputed, compute them using (this sage script)[https://github.com/HorizenLabs/poseidon2/blob/main/poseidon2_rust_params.sage]
  3. Use the proper constants to generate Poseidon2Params and create a new Poseidon2 class instance using your desired prime
import { Poseidon2, F1Field, Poseidon2Params } from "poseidon2";

// call this function with your parameters from sage/horizen labs' precomputed constants
function getPoseidon2Params(
  t: number,
  d: number,
  rounds_f: number,
  rounds_p: number,
  mat_internal_diag_m_1: bigint[],
  mat_internal: bigint[][],
  round_constants: bigint[][]
): Poseidon2Params {
  const r = rounds_f / 2;
  const rounds = rounds_f + rounds_p;
  return {
    t,
    d,
    rounds_f_beginning: r,
    rounds_p,
    rounds_f_end: r,
    rounds,
    mat_internal_diag_m_1: mat_internal_diag_m_1,
    _mat_internal: mat_internal,
    round_constants: round_constants,
  };
}

//ex: For Vesta prime, t=3 https://github.com/HorizenLabs/poseidon2/blob/main/plain_implementations/src/poseidon2/poseidon2_instance_vesta.rs

const field = new F1Field(
  BigInt(
    "28948022309329048855892746252171976963363056481941647379679742748393362948097"
  )
);
const MAT_DIAG3_M_1 = [
  BigInt("0x0000000000000000000000000000000000000000000000000000000000000001"),
  BigInt("0x0000000000000000000000000000000000000000000000000000000000000001"),
  BigInt("0x0000000000000000000000000000000000000000000000000000000000000002"),
];
const MAT_INTERNAL3 = [
  [
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000002"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000001"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000001"
    ),
  ],
  [
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000001"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000002"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000001"
    ),
  ],
  [
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000001"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000001"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000003"
    ),
  ],
];
const RC3 = [
  [
    BigInt(
      "0x21512346b8ece60d5951c1505089c2b4220707ca56373bb9d828fa33bbfd2a31"
    ),
    BigInt(
      "0x2b3a40252c69e83e92c548e199bbbeba4291e0d7fc3b4810193606753da588c8"
    ),
    BigInt(
      "0x2a1a778e3f303c4187c082ea4475734596fb10bd2954843e12be80e8c1c0d464"
    ),
  ],
  [
    BigInt(
      "0x224d2355fc17ee0b5e46455d2ef3a85cfaa88b08689b0d0e4c111094fd780093"
    ),
    BigInt(
      "0x2241de16388cdd7ffda42e0838b5d59bc2182f14bbef622fa633d8b87250a740"
    ),
    BigInt(
      "0x325f11e96905193f6836e6fa2c727dd0261ea083fedde9873f1e7b9d90419833"
    ),
  ],
  [
    BigInt(
      "0x1cc541b9ed19280c216f6b90876cbe83d07ba14fcc6f2af068e1dda739f5acb9"
    ),
    BigInt(
      "0x0f6f3f6703c0dcd136b24ddb8766fbcd69bbc9cb3bb20a1da2f7130c4ba62664"
    ),
    BigInt(
      "0x352376600a75802c6e6c6da69001e0376328848bc7ada465176d571ba029a20b"
    ),
  ],
  [
    BigInt(
      "0x2b1708d59adc4ba04a6bcb2dd264c1b014e0b7bae9bb3af916eb276ee3a34565"
    ),
    BigInt(
      "0x161c8a77adcd1a5f8dad71c3b044ce64bab9de792195da91a0b0acca4f8b4568"
    ),
    BigInt(
      "0x1d53e37d6ddf6dd88beb25c0870b2d0af2a51efb6ada05c4ac7e5099a71499e0"
    ),
  ],
  [
    BigInt(
      "0x0b6d7adb7b72cfaee0184354accbff821a14efb48b46405b397c037a5e15f095"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x2444c70bc898765b95c5438156c28671cfd20569a8d31b3f08cfa60d2bb18d6e"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1eca31224b0d4ae965b179fd952d958de48a5de147348ca5dd00790d5c76fb2f"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0c3f882f7a3bd8ae1eb328e026f6419db30a5026c279df1219499333ef8caa06"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x38011264a16e7cf3e96f029dbfe344e778314b1e2e9d8a2f8f8f76ff5795430d"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3119da354a6f450bf8f700b89b8319a6f57d6278bfb0bbf9d8e37d55c9f3133d"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0bbe0649314a68a31d5e8222bfec7b1298fc5bc1e6ea098675c94695aa3aa221"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x2238971cffd7a12e565e591c0b28c8e76a4582d57892d3db5c8be394a60ba3e9"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1badbb1e2e9734afa09ff6c92e98038b9e329e0c5d0bac9a7d7996392f5caf78"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x37dbb6c5059651ae1362eba3195c08716dab6a61ce8476b5cebd09274a53413c"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3ca22f38e795e433ae9a8d2d5f1d535bbe1a3c3fdadcd549a718e72cd257bb09"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0854ff209558742b8d9b0cbe9db7767f33668f1f8888458bc954025ffe84b7da"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x377699a38c21b41939a5098a8202ed55b4d3472e01f185f4336f4c6c879051ad"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3492b7170200764635922920ad5e3c8761fbbcbaeaa2fc08a59f9ddac49a59ed"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x372c88a6b45c1593f353789be4cdce85dd2ea1adfca9d8444c83b7a990921a25"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3d0996734441d7d414e14d72e46eb6cb3d403a822ce642357e1319d169f4ce6f"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x026362f8c8a86b5afadc22b1cc0aa53e9da137607812778e47d5f86740722a52"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x195b6294bdf65bb0c07569f6c6193de7e5e9ea5b17b5adc39179ff15280fda29"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x11dfbb5f5e48ea973c6ef2ece89463c5316bc767896b67b88be18a1d858d6f52"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x071180314ab2e242cc0552b728495b97e0c2e073970a264c43397356d6ef6c99"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x13c1cc0a221c29fde3183f7dc644004d3f4dd341fe7626996ce68c69d73204c5"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x06fc0f5f038d0ab20f4815ba721b366824bf534980265836b224fecfccb6fcaf"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x122e97658c701fcb7b25d8ce0629f2942dd8f07d6ac06a91320a6f1f4421fd59"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3a19573d57741adba1942d72016391d115a1971af158cfe2a776cb506d714272"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3b34dfdced639990194ad27c8d3bebd9e6657350c0c522a2b65f2ace44dd16cf"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x2d39cfe678f0816cf3bc7a0476517c070d9db6b0f20aa849fc9746e4be5bdf80"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1c2e919d0e061629fd6b5416898dc1d5a5cd0e130531151d18480906ea3d9cc5"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3dae30c784fd66c4a551a6b0a9551747fc1cae54522bb25238f06a7a3e4490cb"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0264c23f67c44aa792f1c731655e1c9eefc4b4b808913f6bb3806ee56caf9c8b"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0fa6d7c32c55e7621d72604c5abc1d970e7569dbf1475f989816be1ac248f889"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x2516928d25d3fe4ca89ff71d5958f4f256d86457b58215dc8c1b02454314ff19"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x10842e1683519bc44c3b3de92cf860e9185c5ed67b20662ae8c4f50008de4780"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x036c65d30abc46a63c4b26ea1e17c5325181354f800fa4c4f207ed1849bb8b3c"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1577e14026128fcbe30d7fe646e0cfcf5a91052f2cadc41553e10aa4ea94eb81"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x38814490cf1681f17c23adf62ea2988d48fdce37b3a2fc259b090391d72be770"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3c24dd5b9460893f28e95b9cbaaba0e1b6af9c00d8182b66ec771ca957b4cb8d"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x367180fac58037ec0d86a1932aabe6a5e353feaf64b1acaaf208a79f711fe35f"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x28ad8a1ecc6d58bf0cbff23e654b824abecae09905278fffa65e9b0d634d9205"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x046fe9ca53b25a411a48d539b09984e2e04bbfe5bfdbb3d390e7489c2cecc4bf"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1b6869c3d4333173de4546f09cee0dea3ae707dfa5e1bcebf9d7671cf766aac0"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1ac8cb354ad46130e09e72c559d322a6daf108002e5f1040c0db23e21ba7b12d"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x16ff5289ab75696ff12f1a2207ee96d0824574cedc0bb3558f4a6ae6e674c446"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3b7f271e38ba8cde9b5fabbe82eae1b848b78a32022516d4cfa423062a3632a1"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x23c4be170342843749dac4e883d34ef66ac377a41c53edfa136f0ba50d0fe5a3"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x366862ca8fd49db9b624d9a1e33b393cf761a181813955f48ff1d8d16d7d7d73"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x2b12d66066df3e3446f8fcc6bc74aeb1dadb4f06f5d1b49646c52708c447cd14"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0a88d5bde48f9b752b856a2646a793cf285473c38870624240b143758c0b5289"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x1cfea95345ce89e544d0447eb5a655610588ac2097f3008389897701d404c98f"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3a9ec343c1c6a122f3897126da51f92d0187ce6e0221cb23bb1797fe4ba72e1d"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3bf940ada3cf20415d3b0b12dc1e0ecededea4dc1e5d7d1587edb6b4c79342f6"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x008621ee09a0ef69dee34dcea9261a2adfa38e8304e461a9635bf49c0f36d4be"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x209cd0df3e50c56186a5db349b595bad4395036a310c098ecea3d041576725fd"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x25b9a4649aa7d962e12ba088d37d5b582f5f5c160c8d28c03294c26a52447f18"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x05ec12eb5698ef5afe1a8e225a299afc37b923dfb5094870f4ad979aa416fbed"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x3e682fbf59f4cca0b6d50829d76c246e65b7f78d939191d570c977e4c5257d0b"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x0b850ec39f210fbf8797cd35565461378546c06a342edc84dc7831ce36614009"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
    BigInt(
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ),
  ],
  [
    BigInt(
      "0x290b9a83a1cb831f478bd70ebb8930d0cc23f44443b3d1e61dd60f41b6a49274"
    ),
    BigInt(
      "0x04bc379725cf05684871ffeed475d2d2bba63620f86306bb445ab768ba2aa185"
    ),
    BigInt(
      "0x2328f4080eceecfef5ccd20da1be4bcd31ae5cc77aef7ae71c51e18c59c3f1ed"
    ),
  ],
  [
    BigInt(
      "0x302caec20a4e995e4ccc8565a77af10e49b3f7754b9a5967157944c30743b1bb"
    ),
    BigInt(
      "0x10741146ca5ef1a2a085754a2ed15a71fb495875bb63c5438ee5bf9d10e8c058"
    ),
    BigInt(
      "0x1a371581be47518396a1748d6538e2f4ff683d3405f7f5f73d6b9c52d1b99d9d"
    ),
  ],
  [
    BigInt(
      "0x049f92746cde1b4280a5d7e8da69b7eefe1a2c4905d2846a69c11f4c22e06bf8"
    ),
    BigInt(
      "0x3b8e5dca75c3cfb9c2579fb74cae071c8dc339208ca47deec9065e78dc881ba7"
    ),
    BigInt(
      "0x11a05a9592274f3cfd9b83b849c774f3c53dd187a65fdd807765337ffdb6ebbe"
    ),
  ],
  [
    BigInt(
      "0x32d4144bd5e6a92072e23ab63c252bf1bdcff45c185f2b14bec92202465278b4"
    ),
    BigInt(
      "0x3d8a49dc1f8ff51cb94645a994a818a1483f37fe38c0a863610ae6d1f59f4566"
    ),
    BigInt(
      "0x399070ea6f6b8ec5569408200d7e3c9f1935e00ac893af9a766efb21166bfe36"
    ),
  ],
];

const instance = new Poseidon2(
  getPoseidon2Params(3, 5, 8, 56, MAT_DIAG3_M_1, MAT_INTERNAL3, RC3),
  field
);

const state = [BigInt(0), BigInt(1), BigInt(2)];
const permuteResult = instance.permute(state);
console.log(permuteResult);