Documentation ¶
Overview ¶
Copyright 2013 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- func FeAdd(out, a, b *FieldElement)
- func FeCMove(f, g *FieldElement, b int32)
- func FeCopy(dst, src *FieldElement)
- func FeFromBytes(v *FieldElement, buf []byte)
- func FeInvSqrt(out, a *FieldElement)
- func FeInvert(out, z *FieldElement)
- func FeIsNegative(f *FieldElement) byte
- func FeIsNonZero(f *FieldElement) int32
- func FeMul(out, a, b *FieldElement)
- func FeNeg(out, a *FieldElement)
- func FeOne(fe *FieldElement)
- func FeReduce(t, v *FieldElement)
- func FeSqrt(out, a *FieldElement)
- func FeSquare(out, a *FieldElement)
- func FeSquare2(out, a *FieldElement)
- func FeSub(out, a, b *FieldElement)
- func FeToBytes(r *[32]byte, v *FieldElement)
- func FeZero(fe *FieldElement)
- func GeScalarMult(h *ExtendedGroupElement, a *[32]byte, A *ExtendedGroupElement)
- func GeScalarMultBase(h *ExtendedGroupElement, a *[32]byte)
- func GeScalarMultVartime(h *ExtendedGroupElement, a *[32]byte, A *ExtendedGroupElement)
- type CachedGroupElement
- type CompletedGroupElement
- func (c *CompletedGroupElement) Add(p *ExtendedGroupElement, q *CachedGroupElement)
- func (c *CompletedGroupElement) MixedAdd(p *ExtendedGroupElement, q *PreComputedGroupElement)
- func (c *CompletedGroupElement) MixedSub(p *ExtendedGroupElement, q *PreComputedGroupElement)
- func (c *CompletedGroupElement) Sub(p *ExtendedGroupElement, q *CachedGroupElement)
- func (c *CompletedGroupElement) ToExtended(r *ExtendedGroupElement)
- func (c *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement)
- type ExtendedGroupElement
- func (p *ExtendedGroupElement) Double(r *CompletedGroupElement)
- func (p *ExtendedGroupElement) FromBytes(s []byte) bool
- func (p *ExtendedGroupElement) Neg(s *ExtendedGroupElement)
- func (p *ExtendedGroupElement) String() string
- func (p *ExtendedGroupElement) ToBytes(s *[32]byte)
- func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement)
- func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement)
- func (p *ExtendedGroupElement) Zero()
- type FieldElement
- type PreComputedGroupElement
- type ProjectiveGroupElement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FeAdd ¶
func FeAdd(out, a, b *FieldElement)
func FeCMove ¶
func FeCMove(f, g *FieldElement, b int32)
Replace (f,g) with (g,g) if b == 1; replace (f,g) with (f,g) if b == 0.
Preconditions: b in {0,1}.
func FeCopy ¶
func FeCopy(dst, src *FieldElement)
func FeFromBytes ¶
func FeFromBytes(v *FieldElement, buf []byte)
func FeInvSqrt ¶
func FeInvSqrt(out, a *FieldElement)
Sets fe to 1/sqrt(a). Requires a to be a square. Returns fe.
func FeInvert ¶
func FeInvert(out, z *FieldElement)
func FeIsNegative ¶
func FeIsNegative(f *FieldElement) byte
func FeIsNonZero ¶
func FeIsNonZero(f *FieldElement) int32
func FeOne ¶
func FeOne(fe *FieldElement)
func FeReduce ¶
func FeReduce(t, v *FieldElement)
func FeSqrt ¶
func FeSqrt(out, a *FieldElement)
Sets fe to sqrt(a). Requires a to be a square. Returns fe.
func FeToBytes ¶
func FeToBytes(r *[32]byte, v *FieldElement)
func FeZero ¶
func FeZero(fe *FieldElement)
func GeScalarMult ¶
func GeScalarMult(h *ExtendedGroupElement, a *[32]byte, A *ExtendedGroupElement)
geScalarMult computes h = a*B, where
a = a[0]+256*a[1]+...+256^31 a[31] B is the Ed25519 base point (x,4/5) with x positive.
Preconditions:
a[31] <= 127
func GeScalarMultBase ¶
func GeScalarMultBase(h *ExtendedGroupElement, a *[32]byte)
geScalarMultBase computes h = a*B, where
a = a[0]+256*a[1]+...+256^31 a[31] B is the Ed25519 base point (x,4/5) with x positive.
Preconditions:
a[31] <= 127
func GeScalarMultVartime ¶
func GeScalarMultVartime(h *ExtendedGroupElement, a *[32]byte, A *ExtendedGroupElement)
Types ¶
type CachedGroupElement ¶
type CachedGroupElement struct {
Z, T2d FieldElement
// contains filtered or unexported fields
}
func (*CachedGroupElement) CMove ¶
func (r *CachedGroupElement) CMove(u *CachedGroupElement, b int32)
Set to u conditionally based on b
func (*CachedGroupElement) Neg ¶
func (r *CachedGroupElement) Neg(t *CachedGroupElement)
Set to negative of t
func (*CachedGroupElement) Zero ¶
func (r *CachedGroupElement) Zero()
type CompletedGroupElement ¶
type CompletedGroupElement struct {
X, Y, Z, T FieldElement
}
func (*CompletedGroupElement) Add ¶
func (c *CompletedGroupElement) Add(p *ExtendedGroupElement, q *CachedGroupElement)
geAdd
func (*CompletedGroupElement) MixedAdd ¶
func (c *CompletedGroupElement) MixedAdd(p *ExtendedGroupElement, q *PreComputedGroupElement)
func (*CompletedGroupElement) MixedSub ¶
func (c *CompletedGroupElement) MixedSub(p *ExtendedGroupElement, q *PreComputedGroupElement)
func (*CompletedGroupElement) Sub ¶
func (c *CompletedGroupElement) Sub(p *ExtendedGroupElement, q *CachedGroupElement)
geSub
func (*CompletedGroupElement) ToExtended ¶
func (c *CompletedGroupElement) ToExtended(r *ExtendedGroupElement)
func (*CompletedGroupElement) ToProjective ¶
func (c *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement)
type ExtendedGroupElement ¶
type ExtendedGroupElement struct {
X, Y, Z, T FieldElement
}
func G ¶
func G() *ExtendedGroupElement
func (*ExtendedGroupElement) Double ¶
func (p *ExtendedGroupElement) Double(r *CompletedGroupElement)
func (*ExtendedGroupElement) FromBytes ¶
func (p *ExtendedGroupElement) FromBytes(s []byte) bool
func (*ExtendedGroupElement) Neg ¶
func (p *ExtendedGroupElement) Neg(s *ExtendedGroupElement)
func (*ExtendedGroupElement) String ¶
func (p *ExtendedGroupElement) String() string
func (*ExtendedGroupElement) ToBytes ¶
func (p *ExtendedGroupElement) ToBytes(s *[32]byte)
func (*ExtendedGroupElement) ToCached ¶
func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement)
func (*ExtendedGroupElement) ToProjective ¶
func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement)
func (*ExtendedGroupElement) Zero ¶
func (p *ExtendedGroupElement) Zero()
type FieldElement ¶
type FieldElement [5]uint64
FieldElement represents an element of the field GF(2^255-19). An element t represents the integer t[0] + t[1]*2^51 + t[2]*2^102 + t[3]*2^153 + t[4]*2^204.
func (*FieldElement) Equals ¶
func (fe *FieldElement) Equals(a *FieldElement) bool
Returns whether fe equals a.
func (*FieldElement) IsNegativeI ¶
func (fe *FieldElement) IsNegativeI() int32
Returns 1 if fe is negative, otherwise 0.
func (*FieldElement) IsNonZeroI ¶
func (fe *FieldElement) IsNonZeroI() int32
Returns 1 if fe is non-zero, otherwise 0.
func (*FieldElement) IsOneI ¶
func (fe *FieldElement) IsOneI() int32
Returns 1 if fe is equal to one, otherwise 0.
func (*FieldElement) String ¶
func (fe *FieldElement) String() string
type PreComputedGroupElement ¶
type PreComputedGroupElement struct {
// contains filtered or unexported fields
}
func (*PreComputedGroupElement) CMove ¶
func (p *PreComputedGroupElement) CMove(u *PreComputedGroupElement, b int32)
Set to u conditionally based on b
func (*PreComputedGroupElement) Neg ¶
func (p *PreComputedGroupElement) Neg(t *PreComputedGroupElement)
Set to negative of t
func (*PreComputedGroupElement) Zero ¶
func (p *PreComputedGroupElement) Zero()
type ProjectiveGroupElement ¶
type ProjectiveGroupElement struct {
X, Y, Z FieldElement
}
func (*ProjectiveGroupElement) Double ¶
func (p *ProjectiveGroupElement) Double(r *CompletedGroupElement)
func (*ProjectiveGroupElement) ToBytes ¶
func (p *ProjectiveGroupElement) ToBytes(s *[32]byte)
func (*ProjectiveGroupElement) Zero ¶
func (p *ProjectiveGroupElement) Zero()