mirror of https://github.com/gtank/ristretto255
Refactor const.go
This commit is contained in:
parent
8264e09462
commit
6140fa2e7b
|
@ -1,19 +1,13 @@
|
|||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 George Tankersley. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package edwards25519
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"sync"
|
||||
|
||||
. "github.com/gtank/ristretto255/internal/edwards25519/internal/edwards25519"
|
||||
)
|
||||
import "math/big"
|
||||
|
||||
var (
|
||||
CONST_SQRT_M1, _ = new(big.Int).SetString("19681161376707505956807079304988542015446066515923890162744021073123829784752", 10)
|
||||
CONST_SQRT_AD_MINUS_ONE, _ = new(big.Int).SetString("25063068953384623474111414158702152701244531502492656460079210482610430750235", 10)
|
||||
CONST_INVSQRT_A_MINUS_D, _ = new(big.Int).SetString("54469307008909316920995813868745141605393597292927456921205312896311721017578", 10)
|
||||
CONST_ONE_MINUS_D_SQ, _ = new(big.Int).SetString("1159843021668779879193775521855586647937357759715417654439879720876111806838", 10)
|
||||
CONST_D_MINUS_ONE_SQ, _ = new(big.Int).SetString("40440834346308536858101042469323190826248399146238708352240133220865137265952", 10)
|
||||
|
||||
SQRT_M1 FieldElement
|
||||
SQRT_AD_MINUS_ONE FieldElement
|
||||
INVSQRT_A_MINUS_D FieldElement
|
||||
|
@ -21,13 +15,15 @@ var (
|
|||
D_MINUS_ONE_SQ FieldElement
|
||||
)
|
||||
|
||||
var once sync.Once
|
||||
|
||||
func init() {
|
||||
once.Do(initConstants)
|
||||
}
|
||||
var (
|
||||
CONST_SQRT_M1, _ = new(big.Int).SetString("19681161376707505956807079304988542015446066515923890162744021073123829784752", 10)
|
||||
CONST_SQRT_AD_MINUS_ONE, _ = new(big.Int).SetString("25063068953384623474111414158702152701244531502492656460079210482610430750235", 10)
|
||||
CONST_INVSQRT_A_MINUS_D, _ = new(big.Int).SetString("54469307008909316920995813868745141605393597292927456921205312896311721017578", 10)
|
||||
CONST_ONE_MINUS_D_SQ, _ = new(big.Int).SetString("1159843021668779879193775521855586647937357759715417654439879720876111806838", 10)
|
||||
CONST_D_MINUS_ONE_SQ, _ = new(big.Int).SetString("40440834346308536858101042469323190826248399146238708352240133220865137265952", 10)
|
||||
)
|
||||
|
||||
func initConstants() {
|
||||
feFromBig(&SQRT_M1, CONST_SQRT_M1)
|
||||
feFromBig(&SQRT_AD_MINUS_ONE, CONST_SQRT_AD_MINUS_ONE)
|
||||
feFromBig(&INVSQRT_A_MINUS_D, CONST_INVSQRT_A_MINUS_D)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 George Tankersley. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 George Tankersley. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Copyright 2019 George Tankersley. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
|
Loading…
Reference in New Issue