Parcourir la source

cln16sidh: generalize toBigInt to work on slices

trials/prep_p503_trial3
Henry de Valence il y a 7 ans
Parent
révision
01b4238748
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. +5
    -1
      field_test.go

+ 5
- 1
field_test.go Voir le fichier

@@ -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


Chargement…
Annuler
Enregistrer