binaryfield

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongInput is returned if the input is wrong
	ErrWrongInput = errors.New("wrong input")
)
View Source
var File_github_com_getamis_alice_crypto_binaryfield_message_proto protoreflect.FileDescriptor

Functions

func EqualSlice

func EqualSlice(x, y []*FieldElement) bool

Types

type BinaryMessage

type BinaryMessage struct {
	Low  uint64 `protobuf:"varint,1,opt,name=low,proto3" json:"low,omitempty"`
	High uint64 `protobuf:"varint,2,opt,name=high,proto3" json:"high,omitempty"`
	// contains filtered or unexported fields
}

func TransFieldElementMsg

func TransFieldElementMsg(u []*FieldElement) []*BinaryMessage

func (*BinaryMessage) Descriptor deprecated

func (*BinaryMessage) Descriptor() ([]byte, []int)

Deprecated: Use BinaryMessage.ProtoReflect.Descriptor instead.

func (*BinaryMessage) GetHigh

func (x *BinaryMessage) GetHigh() uint64

func (*BinaryMessage) GetLow

func (x *BinaryMessage) GetLow() uint64

func (*BinaryMessage) ProtoMessage

func (*BinaryMessage) ProtoMessage()

func (*BinaryMessage) ProtoReflect

func (x *BinaryMessage) ProtoReflect() protoreflect.Message

func (*BinaryMessage) Reset

func (x *BinaryMessage) Reset()

func (*BinaryMessage) String

func (x *BinaryMessage) String() string

func (*BinaryMessage) ToFieldElement

func (xMsg *BinaryMessage) ToFieldElement() *FieldElement

type FieldElement

type FieldElement struct {
	// contains filtered or unexported fields
}

FieldElement represents a value in GF(2¹²⁸). the coefficient of x⁰ can be obtained by v.low >> 63. the coefficient of x⁶³ can be obtained by v.low & 1. the coefficient of x⁶⁴ can be obtained by v.high >> 63. the coefficient of x¹²⁷ can be obtained by v.high & 1.

func AddVector

func AddVector(x, y []*FieldElement) ([]*FieldElement, error)

func NewFieldElement

func NewFieldElement(low, high uint64) *FieldElement

func ScalMulFieldElement

func ScalMulFieldElement(element *FieldElement, input []uint8) []*FieldElement

func ToFieldElement

func ToFieldElement(xMsg []*BinaryMessage) []*FieldElement

func (*FieldElement) Add

Add adds two elements of GF(2¹²⁸) and returns the sum.

func (*FieldElement) Copy

func (x *FieldElement) Copy() *FieldElement

func (*FieldElement) Equal

func (x *FieldElement) Equal(y *FieldElement) bool

func (*FieldElement) GetHigh

func (x *FieldElement) GetHigh() uint64

func (*FieldElement) GetLow

func (x *FieldElement) GetLow() uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL