Browse Source

Add utils.ElementArrayToBigIntArray

feature/utils-elembigintconv
arnaucube 4 years ago
parent
commit
b98a9fe65a
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      utils/utils.go

+ 13
- 0
utils/utils.go

@ -103,6 +103,7 @@ func CheckBigIntArrayInField(arr []*big.Int) bool {
return true
}
// BigIntArrayToElementArray converts an array of *big.Int into an array of *ff.Element
func BigIntArrayToElementArray(bi []*big.Int) []*ff.Element {
var o []*ff.Element
for i := range bi {
@ -110,3 +111,15 @@ func BigIntArrayToElementArray(bi []*big.Int) []*ff.Element {
}
return o
}
// ElementArrayToBigIntArray converts an array of *ff.Element into an array of *big.Int
func ElementArrayToBigIntArray(e []*ff.Element) []*big.Int {
var o []*big.Int
for i := range e {
ei := e[i]
bi := big.NewInt(0)
ei.ToBigIntRegular(bi)
o = append(o, bi)
}
return o
}

Loading…
Cancel
Save