Skip to content

Commit

Permalink
update constantine to version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
markspanbroek committed Jul 15, 2024
1 parent 8a54c69 commit 4104602
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions poseidon2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export toF
export elements
export types

# workaround for "undeclared identifier: 'getCurveOrder'"
import constantine/math/config/curves
export curves
# workaround for "undeclared identifier: 'getModulus'"
import constantine/named/algebras
export algebras
2 changes: 1 addition & 1 deletion poseidon2.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ author = "nim-poseidon2 authors"
description = "Poseidon2 hash function"
license = "MIT"

requires "https://github.com/mratsim/constantine#ab6fa6ae1bbbd1b10071a92ec209b381b5d82511"
requires "https://github.com/mratsim/constantine == 0.1.0"
6 changes: 3 additions & 3 deletions poseidon2/io.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import std/options
import constantine/math/arithmetic
import constantine/math/io/io_bigints
import constantine/math/io/io_fields
import constantine/math/config/curves
import constantine/named/algebras
import ./types

export curves
export algebras

func fromOpenArray(_: type F, bytes: openArray[byte]): F =
F.fromBig(B.unmarshal(bytes, littleEndian))
Expand All @@ -19,7 +19,7 @@ func fromBytes*(_: type F, bytes: array[32, byte]): Option[F] =
## Converts bytes into a field element. The byte array is interpreted as a
## canonical little-endian big integer.
let big = B.unmarshal(bytes, littleEndian)
if bool(big < F.fieldMod()):
if bool(big < F.getModulus()):
return some(F.fromBig(big))

func toBytes*(element: F): array[32, byte] =
Expand Down
2 changes: 1 addition & 1 deletion poseidon2/roundfun.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import
constantine/math/arithmetic,
constantine/math/config/curves
constantine/named/algebras

import ./types
import ./roundconst
Expand Down
2 changes: 1 addition & 1 deletion poseidon2/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import
constantine/math/arithmetic,
constantine/math/io/io_fields,
constantine/math/io/io_bigints,
constantine/math/config/curves
constantine/named/algebras

#-------------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion tests/poseidon2/testSponge.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import std/unittest
import std/sequtils

import constantine/math/io/io_fields
import constantine/math/arithmetic

import poseidon2/types
import poseidon2/io
Expand Down

0 comments on commit 4104602

Please sign in to comment.