Selaa lähdekoodia

cln16sidh: generalize toBigInt to work on slices

trials/prep_p503_trial3
Henry de Valence 7 vuotta sitten
vanhempi
commit
01b4238748
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  1. +5
    -1
      field_test.go

+ 5
- 1
field_test.go Näytä tiedosto

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


Ladataan…
Peruuta
Tallenna