mirror of https://github.com/gtank/ristretto255
make things more generally presentable
This commit is contained in:
parent
08a76875a4
commit
0a030f62c0
|
@ -0,0 +1,11 @@
|
|||
This is foremost an implementation of the curve Ed25519 that satisfies Go's
|
||||
elliptic.Curve interface. It targets amd64 systems, and is eventually intended
|
||||
to be a legible general-purpose library along the lines of curve25519-dalek.
|
||||
|
||||
It is also an implementation of GF(2^255-19) field operations in a 64-bit
|
||||
representation, in both pure Go and plan9 assembly for amd64. This code is
|
||||
currently package-internal.
|
||||
|
||||
The library is a WORK IN PROGRESS. Everything will change dramatically as
|
||||
development continues. There are no guarantees of stability, functionality,
|
||||
correctness, or safety. We aren't open yet, come back later!
|
19
ed25519.go
19
ed25519.go
|
@ -94,7 +94,7 @@ func (curve ed25519Curve) Double(x1, y1 *big.Int) (x, y *big.Int) {
|
|||
|
||||
// ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
|
||||
func (curve ed25519Curve) ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int) {
|
||||
// if either coordinate is nil, return the point at infinity
|
||||
// if either coordinate is nil, return the identity point
|
||||
if x1 == nil || y1 == nil {
|
||||
x = new(big.Int).Set(bigZero)
|
||||
y = new(big.Int).Set(bigOne)
|
||||
|
@ -144,13 +144,10 @@ func (curve ed25519Curve) scalarFromBytes(out *[32]byte, in []byte) {
|
|||
}
|
||||
}
|
||||
|
||||
// // ScalarBaseMult returns k*G, where G is the base point of the group and k is
|
||||
// // an integer in big-endian form.
|
||||
// func (curve ed25519Curve) ScalarBaseMult(k []byte) (x, y *big.Int) {
|
||||
// var p edwards25519.ExtendedGroupElement
|
||||
// var scBytes [32]byte
|
||||
|
||||
// curve.scalarFromBytes(&scBytes, k)
|
||||
// edwards25519.GeScalarMultBase(&p, &scBytes)
|
||||
// return extendedToAffine(&p)
|
||||
// }
|
||||
// ScalarBaseMult returns k*G, where G is the base point of the curve and k is
|
||||
// an integer in big-endian form. The difference between this and
|
||||
// arbitrary-point ScalarMult is the availability of precomputed multiples of
|
||||
// the base point.
|
||||
func (curve ed25519Curve) ScalarBaseMult(k []byte) (x, y *big.Int) {
|
||||
panic("not yet implemented")
|
||||
}
|
||||
|
|
|
@ -369,24 +369,7 @@ func BenchmarkScalarMult(b *testing.B) {
|
|||
// }
|
||||
// }
|
||||
|
||||
// // BENCHMARKS
|
||||
|
||||
// func BenchmarkScalarBaseMult(b *testing.B) {
|
||||
// ed := Ed25519()
|
||||
|
||||
// var k [32]byte
|
||||
// _, err := io.ReadFull(rand.Reader, k[:])
|
||||
// if err != nil {
|
||||
// b.Fatal(err)
|
||||
// }
|
||||
// k[0] &= 248
|
||||
// k[31] &= 127
|
||||
// k[31] |= 64
|
||||
|
||||
// for i := 0; i < b.N; i++ {
|
||||
// _, _ = ed.ScalarBaseMult(k[:])
|
||||
// }
|
||||
// }
|
||||
// COMPARATIVE FIELD BENCHMARKS
|
||||
|
||||
var radix51A = field.FieldElement{
|
||||
486662, 0, 0, 0, 0,
|
||||
|
@ -418,7 +401,6 @@ func BenchmarkFeFromBig(b *testing.B) {
|
|||
|
||||
var feOnes field.FieldElement = [5]uint64{1, 1, 1, 1, 1}
|
||||
|
||||
//func FeToBig(h *FieldElement) *big.Int {
|
||||
func BenchmarkFeToBig(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = field.FeToBig(&feOnes)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// Copyright 2017 George Tankersley. All rights reserved.
|
||||
// Copyright (c) 2017 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.
|
||||
|
||||
// Constants used in the implementation of GF(2^255-19) field arithmetic.
|
||||
package radix51
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// Copyright 2017 George Tankersley. All rights reserved.
|
||||
// Copyright (c) 2017 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.
|
||||
|
||||
// Field arithmetic in radix 2^51 representation. This code is a port of the
|
||||
// public domain amd64-51-30k version of ed25519 from SUPERCOP.
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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.
|
||||
|
||||
// +build !amd64 noasm
|
||||
|
||||
package radix51
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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.
|
||||
|
||||
// +build amd64,!noasm
|
||||
|
||||
package radix51
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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.
|
||||
|
||||
// Based on assembly generated by PeachPy. Equivalent to the Go in fe_mul.go,
|
||||
// which was originally based on the amd64-51-30k assembly in SUPERCOP.
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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.
|
||||
|
||||
// +build !amd64 noasm
|
||||
|
||||
package radix51
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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.
|
||||
|
||||
// +build amd64,!noasm
|
||||
|
||||
package radix51
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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.
|
||||
|
||||
// +build amd64,!noasm
|
||||
|
||||
// func FeSquare(outp *uint64, xp *uint64)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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 radix51
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright (c) 2017 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 radix51
|
||||
|
||||
import "unsafe"
|
||||
|
|
Loading…
Reference in New Issue