Documentation ¶
Index ¶
- Variables
- type GF255e
- func (d *GF255e) Add(a, b *GF255e) *GF255e
- func (d *GF255e) CondNeg(a *GF255e, ctl uint64) *GF255e
- func (d *GF255e) CondOrFrom(a *GF255e, mask uint64) *GF255e
- func (d *GF255e) Decode(src []byte) uint64
- func (d *GF255e) DecodeReduce(src []byte) *GF255e
- func (d *GF255e) Encode(dst []byte) []byte
- func (d *GF255e) Eq(a *GF255e) uint64
- func (d *GF255e) Half(a *GF255e) *GF255e
- func (d *GF255e) Inv(a *GF255e) *GF255e
- func (d *GF255e) IsZero() uint64
- func (d *GF255e) Legendre() uint64
- func (d *GF255e) Lsh(a *GF255e, n uint) *GF255e
- func (d *GF255e) Mul(a, b *GF255e) *GF255e
- func (d *GF255e) Neg(a *GF255e) *GF255e
- func (d *GF255e) Select(a, b *GF255e, ctl uint64) *GF255e
- func (d *GF255e) Set(a *GF255e) *GF255e
- func (d *GF255e) Sqr(a *GF255e) *GF255e
- func (d *GF255e) SqrX(a *GF255e, n uint) *GF255e
- func (d *GF255e) Sqrt(a *GF255e) uint64
- func (d *GF255e) Sub(a, b *GF255e) *GF255e
- type GF255s
- func (d *GF255s) Add(a, b *GF255s) *GF255s
- func (d *GF255s) CondNeg(a *GF255s, ctl uint64) *GF255s
- func (d *GF255s) CondOrFrom(a *GF255s, mask uint64) *GF255s
- func (d *GF255s) Decode(src []byte) uint64
- func (d *GF255s) DecodeReduce(src []byte) *GF255s
- func (d *GF255s) Encode(dst []byte) []byte
- func (d *GF255s) Eq(a *GF255s) uint64
- func (d *GF255s) Half(a *GF255s) *GF255s
- func (d *GF255s) Inv(a *GF255s) *GF255s
- func (d *GF255s) IsZero() uint64
- func (d *GF255s) Legendre() uint64
- func (d *GF255s) Lsh(a *GF255s, n uint) *GF255s
- func (d *GF255s) Mul(a, b *GF255s) *GF255s
- func (d *GF255s) Neg(a *GF255s) *GF255s
- func (d *GF255s) Select(a, b *GF255s, ctl uint64) *GF255s
- func (d *GF255s) Set(a *GF255s) *GF255s
- func (d *GF255s) Sqr(a *GF255s) *GF255s
- func (d *GF255s) SqrX(a *GF255s, n uint) *GF255s
- func (d *GF255s) Sqrt(a *GF255s) uint64
- func (d *GF255s) Sub(a, b *GF255s) *GF255s
Constants ¶
This section is empty.
Variables ¶
var GF255e_EIGHT = GF255e{8, 0, 0, 0}
Field element of value 8.
var GF255e_HUNDREDSEVENTYSIX = GF255e{176, 0, 0, 0}
Field element of value 176.
var GF255e_INVT508 = GF255e{
0xD40D5B5D2BE1CF5D, 0x3B3573987282DD51,
0x3ECCB22800EED6AE, 0x44F35C558E8FAC0B}
Field element of value 1/2^508 (used internally for inversions).
var GF255e_ONE = GF255e{1, 0, 0, 0}
Field element of value 1.
var GF255e_SEVEN = GF255e{7, 0, 0, 0}
Field element of value 7.
var GF255e_THREE = GF255e{3, 0, 0, 0}
Field element of value 3.
var GF255e_THREEHUNDREDEIGHT = GF255e{308, 0, 0, 0}
Field element of value 308.
var GF255e_THREEHUNDREDFORTYTHREE = GF255e{343, 0, 0, 0}
Field element of value 343.
var GF255e_TWENTYSEVEN = GF255e{27, 0, 0, 0}
Field element of value 27.
var GF255e_ZERO = GF255e{0, 0, 0, 0}
Field element of value 0.
var GF255s_INVT508 = GF255s{
0xC7E0DEC400D7BDB6, 0xCCABD4771F6FB10F,
0x940F23A06B74BE6E, 0x1C45852F33548365}
Field element of value 1/2^508 (used internally for inversions).
var GF255s_ONE = GF255s{1, 0, 0, 0}
Field element of value 1.
var GF255s_TWO = GF255s{2, 0, 0, 0}
Field element of value 2.
var GF255s_ZERO = GF255s{0, 0, 0, 0}
Field element of value 0.
Functions ¶
This section is empty.
Types ¶
type GF255e ¶
type GF255e [4]uint64
======================================================================= Field GF255e: integers modulo p = 2^255 - 18651
func (*GF255e) CondOrFrom ¶
d <- d OR (a AND mask) mask value should be 0 or 0xFFFFFFFFFFFFFFFF
func (*GF255e) Decode ¶
Decode element from 32 bytes. If the source is invalid (out of range), then the decoded value is zero, and 0 is returned; otherwise, 1 is returned.
func (*GF255e) DecodeReduce ¶
Decode element from bytes. The input bytes are interpreted as an integer (unsigned little-endian convention) which is reduced modulo the field modulus. By definition, this process cannot fail.
func (*GF255e) Encode ¶
Encode element into exactly 32 bytes. The encoding is appended to the provided slice, and the resulting slice is returned. The extension is done in place if the provided slice has enough capacity.
func (*GF255e) Legendre ¶
Legendre symbol computation; return value:
0 if d == 0 1 if d != 0 and is a quadratic residue -1 if d != 0 and is a not a quadratic residue
Value is returned as uint64, i.e. 0xFFFFFFFFFFFFFFFF for non-squares.
func (*GF255e) SqrX ¶
d <- a^(2^n) for any n >= 0 This is constant-time with regard to a and d, but not to n.
func (*GF255e) Sqrt ¶
Square root computation. If the source value (a) is a quadratic residue, then this function sets this object (d) to a square root of a, and returns 1; otherwise, it sets d to zero and returns 0. When the input is a square, this function returns the square root whose least significant bit (as an integer in the 0..p-1 range) is zero.
type GF255s ¶
type GF255s [4]uint64
======================================================================= Field GF255s: integers modulo p = 2^255 - 3957
func (*GF255s) CondOrFrom ¶
d <- d OR (a AND mask) mask value should be 0 or 0xFFFFFFFFFFFFFFFF
func (*GF255s) Decode ¶
Decode element from 32 bytes. If the source is invalid (out of range), then the decoded value is zero, and 0 is returned; otherwise, 1 is returned.
func (*GF255s) DecodeReduce ¶
Decode element from bytes. The input bytes are interpreted as an integer (unsigned little-endian convention) which is reduced modulo the field modulus. By definition, this process cannot fail.
func (*GF255s) Encode ¶
Encode element into exactly 32 bytes. The encoding is appended to the provided slice, and the resulting slice is returned. The extension is done in place if the provided slice has enough capacity.
func (*GF255s) Legendre ¶
Legendre symbol computation; return value:
0 if d == 0 1 if d != 0 and is a quadratic residue -1 if d != 0 and is a not a quadratic residue
Value is returned as uint64, i.e. 0xFFFFFFFFFFFFFFFF for non-squares.
func (*GF255s) SqrX ¶
d <- a^(2^n) for any n >= 0 This is constant-time with regard to a and d, but not to n.
func (*GF255s) Sqrt ¶
Square root computation. If the source value (a) is a quadratic residue, then this function sets this object (d) to a square root of a, and returns 1; otherwise, it sets d to zero and returns 0. When the input is a square, this function returns the square root whose least significant bit (as an integer in the 0..p-1 range) is zero.