hypercomplex

package module
v0.0.0-...-49d2380 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2017 License: MIT Imports: 5 Imported by: 1

README

hypercomplex

GoDoc

Hyper-Complex large numbers.

Documentation

Overview

Offers functions to work with Hyper-Complex numbers modulo P.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Modulus

type Modulus struct {
	Mod *big.Int
}

func (Modulus) Add

func (m Modulus) Add(a, b MultiComp) MultiComp

func (Modulus) Counterpart

func (m Modulus) Counterpart(a MultiComp) MultiComp

For a given 'a = (r,i)' it returns '(r,-i mod P)'.

func (Modulus) Deterministic

func (m Modulus) Deterministic(source io.Reader, size int) (MultiComp, error)

Creates a MultiComp over the modulus group of the given length 'size'. The argument 'size' must be a power of two.

This function chooses them deterministically. This function is meant to be used with SHAKE-128, SHAKE-256 or similar XOF hash functions. However, the regular "crypto/rand" rand.Reader can be used as well.

func (Modulus) Exp

func (m Modulus) Exp(g MultiComp, exp []byte) MultiComp

func (Modulus) Inverse

func (m Modulus) Inverse(a MultiComp) MultiComp

Computes the modulo inverse of a.

func (Modulus) Multiply

func (m Modulus) Multiply(a, b MultiComp) MultiComp

func (Modulus) Neg

func (m Modulus) Neg(a MultiComp) MultiComp

func (Modulus) Sub

func (m Modulus) Sub(a, b MultiComp) MultiComp

type MultiComp

type MultiComp []*big.Int

Represents a Hyper-Complex number. The number is represented as an array of integers (*big.Int), where the length is a power of two. If a MultiComp contains only one element, it represents an ordinary Number. Otherwise, it consists of two equal-sized halves, where the first one represents the real part and the second one represents the imaginary part.

func (MultiComp) BitLen

func (m MultiComp) BitLen() int

func (MultiComp) Copy

func (m MultiComp) Copy() MultiComp

func (MultiComp) String

func (m MultiComp) String() string

Jump to

Keyboard shortcuts

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