2019-10-15 09:10:39 +00:00
|
|
|
// Copyright 2018 (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 .
|
|
|
|
package avx
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/tzhash/gf127"
|
|
|
|
)
|
|
|
|
|
2019-10-15 09:20:36 +00:00
|
|
|
// GF127 is an alias for a main type.
|
2019-10-15 09:10:39 +00:00
|
|
|
type GF127 = gf127.GF127
|
|
|
|
|
|
|
|
const msb64 = uint64(1) << 63
|
|
|
|
|
2021-12-29 10:19:45 +00:00
|
|
|
// x127x63 represents x^127 + x^63. Used in assembly file.
|
|
|
|
var x127x63 = GF127{msb64, msb64} //nolint:deadcode,varcheck
|
2019-10-15 09:10:39 +00:00
|
|
|
|
|
|
|
// Add sets c to a+b.
|
|
|
|
func Add(a, b, c *GF127)
|
|
|
|
|
|
|
|
// Mul sets c to a*b.
|
|
|
|
func Mul(a, b, c *GF127)
|
|
|
|
|
|
|
|
// Mul10 sets b to a*x.
|
|
|
|
func Mul10(a, b *GF127)
|
|
|
|
|
|
|
|
// Mul11 sets b to a*(x+1).
|
|
|
|
func Mul11(a, b *GF127)
|