mirror of
https://github.com/logos-storage/nim-poseidon2.git
synced 2026-01-02 13:43:08 +00:00
Merge pull request #21 from codex-storage/bump-constantine-gcc14
bumps constantine, updates curves
This commit is contained in:
commit
7749c368a9
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -7,7 +7,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
nim: [1.6.14]
|
||||
nim: [1.6.14, 2.0.14]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: iffy/install-nim@v3
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*
|
||||
!*/
|
||||
!*.*
|
||||
.nimble
|
||||
poseidon2.out
|
||||
16
nimble.lock
Normal file
16
nimble.lock
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": 2,
|
||||
"packages": {
|
||||
"constantine": {
|
||||
"version": "0.1.0",
|
||||
"vcsRevision": "bc3845aa492b52f7fef047503b1592e830d1a774",
|
||||
"url": "https://github.com/mratsim/constantine",
|
||||
"downloadMethod": "git",
|
||||
"dependencies": [],
|
||||
"checksums": {
|
||||
"sha1": "09594d4ce93e83ae377a7a9cb8fd4472b104ca4b"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tasks": {}
|
||||
}
|
||||
@ -16,5 +16,5 @@ export elements
|
||||
export types
|
||||
|
||||
# workaround for "undeclared identifier: 'getCurveOrder'"
|
||||
import constantine/math/config/curves
|
||||
export curves
|
||||
import constantine/named/algebras
|
||||
export algebras
|
||||
|
||||
@ -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#bc3845aa492b52f7fef047503b1592e830d1a774"
|
||||
|
||||
@ -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))
|
||||
@ -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] =
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import
|
||||
constantine/math/arithmetic,
|
||||
constantine/math/config/curves
|
||||
constantine/named/algebras
|
||||
|
||||
import ./types
|
||||
import ./roundconst
|
||||
|
||||
@ -3,12 +3,12 @@ import
|
||||
constantine/math/arithmetic,
|
||||
constantine/math/io/io_fields,
|
||||
constantine/math/io/io_bigints,
|
||||
constantine/math/config/curves
|
||||
constantine/named/algebras
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
type B* = BigInt[254]
|
||||
type F* = Fr[BN254Snarks]
|
||||
type F* = Fr[BN254_Snarks]
|
||||
type S* = (F,F,F)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user