Browse Source

cln16sidh: generalize toBigInt to work on slices

trials/prep_p503_trial3
Henry de Valence 7 years ago
parent
commit
01b4238748
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      field_test.go

+ 5
- 1
field_test.go View File

@@ -11,7 +11,7 @@ import (
// Convert an Fp751Element to a big.Int for testing. Because this is only
// for testing, no big.Int to Fp751Element conversion is provided.

func (x *Fp751Element) toBigInt() *big.Int {
func radix64ToBigInt(x []uint64) *big.Int {
radix := new(big.Int)
// 2^64
radix.UnmarshalText(([]byte)("18446744073709551616"))
@@ -30,6 +30,10 @@ func (x *Fp751Element) toBigInt() *big.Int {
return val
}

func (x *Fp751Element) toBigInt() *big.Int {
return radix64ToBigInt(x[:])
}

func (x Fp751Element) Generate(rand *rand.Rand, size int) reflect.Value {
// Generation strategy: low limbs taken from [0,2^64); high limb
// taken from smaller range


Loading…
Cancel
Save