Documentation ¶
Overview ¶
Package gf127 implements the GF(2^127) arithmetic modulo reduction polynomial x^127 + x^63 + 1 . gf127.go contains common definitions. Other files contain architecture-specific implementations.
Copyright 2019 (c) NSPCC ¶
Package gf127 implements the GF(2^127) arithmetic modulo reduction polynomial 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 .
Index ¶
- 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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Inv ¶
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 ¶
func Random() *GF127
Random returns random element from GF(2^127). Is used mostly for testing.
func (*GF127) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*GF127) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.