Documentation
¶
Overview ¶
Package gf127 implements the GF(2^127) arithmetic modulo (x^127 + x^63 + 1).
This is rather straight-forward re-implementation of C library available here https://github.com/srijs/hwsl2-core . Interfaces are highly influenced by math/big.
gf127.go contains common definitions. Other files contain architecture-specific implementations.
Copyright 2019 © NSPCC
Index ¶
- Constants
- func Add(a, b, c *GF127)
- func And(a, b, c *GF127)
- func CombineTo(a *GF127, b *GF127, c *GF127x2)
- func Inv(a, b *GF127)
- func Mul(a, b, c *GF127)
- func Mul1(a, b *GF127)
- func Mul10(a, b *GF127)
- func Mul10x2(a, b *GF127x2)
- func Mul11(a, b *GF127)
- func Mul11x2(a, b *GF127x2)
- func Split(a *GF127x2) (*GF127, *GF127)
- type GF127
- type GF127x2
Constants ¶
const (
// Size represents [GF127] state size in bytes.
Size = 16
)
Variables ¶
This section is empty.
Functions ¶
func CombineTo ¶ added in v1.1.0
CombineTo 2 elements of GF(2^127) to the respective components of pair.
func Inv ¶ added in v1.1.0
func Inv(a, b *GF127)
Inv sets b to a^-1 Algorithm is based on Extended Euclidean Algorithm and is described by Hankerson, Hernandez, Menezes in https://link.springer.com/content/pdf/10.1007/3-540-44499-8_1.pdf
Types ¶
type GF127 ¶
type GF127 [2]uint64
GF127 represents element of GF(2^127).
func New ¶
New constructs new element of GF(2^127) as hi*x^64 + lo. It is assumed that hi has zero MSB.
func Random ¶ added in v1.1.0
func Random() *GF127
Random returns random element from GF(2^127). Is used mostly for testing.
func (*GF127) Bytes ¶ added in v1.6.0
Bytes represents element of GF(2^127) as byte array of length 16.
func (*GF127) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*GF127) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type GF127x2 ¶ added in v1.1.0
type GF127x2 [2]GF127
GF127x2 represents a pair of elements of GF(2^127) stored together.
func (*GF127x2) Bytes ¶ added in v1.6.0
Bytes represents element of GF(2^127) as byte array of length 32.