INNER CODE UNIT · Go
NewFieldElement
getamis/alice · crypto/binaryfield/binary_field.go:36
func NewFieldElement(low, high uint64) *FieldElement {
return &FieldElement{
low: low,
high: high,
}
}
// Add adds two elements of GF(2¹²⁸) and returns the sum.
func (x *FieldElement) Add(y *FieldElement) *FieldElement {
// Addition in a characteristic 2 field is just XOR.
return NewFieldElement(x.low^y.low, x.high^y.high)
}
func (x *FieldElement) Copy() *FieldElement {
return NewFieldElement(x.low, x.high)
}
func (x *FieldElement) GetLow() uint64 {