mirror of
https://github.com/logos-storage/nim-poseidon2.git
synced 2026-01-02 13:43:08 +00:00
Move int.toF() function into io module
This commit is contained in:
parent
b953cde5f8
commit
f76d8dd654
@ -8,5 +8,6 @@ export sponge
|
||||
export compress
|
||||
export merkle
|
||||
export toBytes
|
||||
export toF
|
||||
export elements
|
||||
export types
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import ./types
|
||||
import constantine/math/arithmetic
|
||||
import constantine/math/io/io_bigints
|
||||
import constantine/math/io/io_fields
|
||||
import constantine/math/config/curves
|
||||
|
||||
export curves
|
||||
@ -35,3 +36,9 @@ iterator elements*(bytes: openArray[byte], _: type F): F =
|
||||
let finalChunk = bytes[chunkStart..<bytes.len] & endMarker
|
||||
let finalElement = F.fromOpenArray(finalChunk)
|
||||
yield finalElement
|
||||
|
||||
# Remark: since `fromInt()` does not work at compile time, this doesn't either
|
||||
func toF*(a: int) : F =
|
||||
var y : F
|
||||
y.fromInt(a)
|
||||
return y
|
||||
|
||||
@ -18,12 +18,6 @@ func getZero*() : F =
|
||||
setZero(z)
|
||||
return z
|
||||
|
||||
# Remark: since `fromInt()` does not work at compile time, this doesn't either
|
||||
func toF*(a: int) : F =
|
||||
var y : F
|
||||
y.fromInt(a)
|
||||
return y
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
const zero* : F = getZero()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import std/unittest
|
||||
import constantine/math/arithmetic
|
||||
import poseidon2/types
|
||||
import poseidon2/io
|
||||
import poseidon2/permutation
|
||||
import poseidon2/compress
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ import std/unittest
|
||||
import constantine/math/arithmetic
|
||||
import constantine/math/io/io_fields
|
||||
import constantine/math/io/io_bigints
|
||||
import constantine/math/config/curves
|
||||
|
||||
import poseidon2/types
|
||||
import poseidon2/io
|
||||
import poseidon2/permutation
|
||||
|
||||
suite "permutation":
|
||||
|
||||
@ -5,6 +5,7 @@ import constantine/math/io/io_fields
|
||||
import constantine/math/arithmetic
|
||||
|
||||
import poseidon2/types
|
||||
import poseidon2/io
|
||||
import poseidon2
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user