mirror of
https://github.com/codex-storage/nim-poseidon2.git
synced 2025-02-21 23:38:31 +00:00
Remove trailing whitespace
This commit is contained in:
parent
5220f372c1
commit
0cdbed1dc2
@ -36,7 +36,7 @@ proc internal_round(j: int; x, y, z: var F) =
|
|||||||
sbox(x)
|
sbox(x)
|
||||||
var s = x ; s += y ; s += z
|
var s = x ; s += y ; s += z
|
||||||
double(z)
|
double(z)
|
||||||
x += s
|
x += s
|
||||||
y += s
|
y += s
|
||||||
z += s
|
z += s
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ proc compress*(a, b : F) : F =
|
|||||||
perm_inplace(x, y, z)
|
perm_inplace(x, y, z)
|
||||||
return x
|
return x
|
||||||
|
|
||||||
proc merkle_root*(xs: openArray[F]) : F =
|
proc merkle_root*(xs: openArray[F]) : F =
|
||||||
let a = low(xs)
|
let a = low(xs)
|
||||||
let b = high(xs)
|
let b = high(xs)
|
||||||
let m = b-a+1
|
let m = b-a+1
|
||||||
@ -85,7 +85,7 @@ proc merkle_root*(xs: openArray[F]) : F =
|
|||||||
let halfn : int = m div 2
|
let halfn : int = m div 2
|
||||||
let n : int = 2*halfn
|
let n : int = 2*halfn
|
||||||
let is_odd : bool = (n != m)
|
let is_odd : bool = (n != m)
|
||||||
|
|
||||||
var ys : seq[F] = newSeq[F](halfn)
|
var ys : seq[F] = newSeq[F](halfn)
|
||||||
|
|
||||||
if not is_odd:
|
if not is_odd:
|
||||||
@ -101,6 +101,6 @@ proc merkle_root*(xs: openArray[F]) : F =
|
|||||||
return merkle_root(ys)
|
return merkle_root(ys)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,17 +17,17 @@ func getZero*() : F =
|
|||||||
setZero(z)
|
setZero(z)
|
||||||
return z
|
return z
|
||||||
|
|
||||||
func toF*(a: int) : F =
|
func toF*(a: int) : F =
|
||||||
var y : F
|
var y : F
|
||||||
fromInt(y, a);
|
fromInt(y, a);
|
||||||
return y
|
return y
|
||||||
|
|
||||||
func hexToF*(s : string) : F =
|
func hexToF*(s : string) : F =
|
||||||
var y : F
|
var y : F
|
||||||
fromHex(y, s)
|
fromHex(y, s)
|
||||||
return y
|
return y
|
||||||
|
|
||||||
func arrayFromHex*[N]( inp: array[N, string]) : array[N, F] =
|
func arrayFromHex*[N]( inp: array[N, string]) : array[N, F] =
|
||||||
var tmp : array[N, F]
|
var tmp : array[N, F]
|
||||||
for i in low(inp)..high(inp):
|
for i in low(inp)..high(inp):
|
||||||
tmp[i] = hexToF( inp[i] )
|
tmp[i] = hexToF( inp[i] )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user