Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Nov 4, 2024
1 parent ca916cf commit 8bc67b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions Stdlib/Cairo/Poseidon.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,19 @@ poseidonHash2 (x y : Field) : Field :=
poseidonHashList (list : List Field) : Field :=
let
go (acc : PoseidonState) : List Field -> PoseidonState
| [] := poseidonHash acc@PoseidonState{s0 := @s0 + 1}
| [x] := poseidonHash acc@PoseidonState{s0 := @s0 + x; s1 := @s1 + 1}
| [] := poseidonHash acc@PoseidonState{s0 := PoseidonState.s0 acc + 1}
| [x] :=
poseidonHash
acc@PoseidonState{
s0 := PoseidonState.s0 acc + x;
s1 := PoseidonState.s1 acc + 1;
}
| (x1 :: x2 :: xs) :=
go (poseidonHash acc@PoseidonState{s0 := @s0 + x1; s1 := @s1 + x2}) xs;
go
(poseidonHash
acc@PoseidonState{
s0 := PoseidonState.s0 acc + x1;
s1 := PoseidonState.s1 acc + x2;
})
xs;
in PoseidonState.s0 (go (mkPoseidonState 0 0 0) list);
2 changes: 1 addition & 1 deletion test/Package.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package : Package :=
github
"anoma"
"juvix-quickcheck"
"4242b864714f98947753544ea1b2cb435f6473d3";
"41daf19e01dd785b1a06b0ddd5b0ddc79522439e";
github "anoma" "juvix-test" "85811914324b082549cb1f500323884442fc793c";
];
};

0 comments on commit 8bc67b8

Please sign in to comment.