nim-goldilocks-hash/poseidon2/permutation.nim
2024-09-24 14:11:53 +02:00

12 lines
327 B
Nim

import ./types
# the Poseidon2 permutation (mutable, in-place version)
proc permInPlace*(state: var State) {. header: "../cbits/goldilocks.h", importc: "goldilocks_poseidon2_permutation", cdecl .}
# the Poseidon2 permutation (pure version)
func perm*(state: State): State =
var tmp = state
permInPlace(tmp)
return tmp