big

package
v0.0.0-...-dfc4593 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package big contains a mostly API-compatible "math/big".Int that JSON-marshals to and from Base64.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Jacobi

func Jacobi(x, y *Int) int

Types

type Int

type Int big.Int

Int is an API-compatible "math/big".Int that JSON-marshals to and from Base64. Only supports positive integers.

func Convert

func Convert(x *big.Int) *Int

Convert from a "math/big".Int

func NewInt

func NewInt(x int64) *Int

func RandInt

func RandInt(rnd io.Reader, max *Int) (*Int, error)

RandInt wraps "crypto/rand".Int: returns a uniform random value in [0, max). It panics if max <= 0.

func (*Int) Abs

func (i *Int) Abs(x *Int) *Int

func (*Int) Add

func (i *Int) Add(x, y *Int) *Int

func (*Int) And

func (i *Int) And(x, y *Int) *Int

func (*Int) AndNot

func (i *Int) AndNot(x, y *Int) *Int

func (*Int) Append

func (i *Int) Append(buf []byte, base int) []byte

func (*Int) Binomial

func (i *Int) Binomial(n, k int64) *Int

func (*Int) Bit

func (i *Int) Bit(j int) uint

func (*Int) BitLen

func (i *Int) BitLen() int

func (*Int) Bits

func (i *Int) Bits() []big.Word

func (*Int) Bytes

func (i *Int) Bytes() []byte

func (*Int) Cmp

func (i *Int) Cmp(y *Int) int

func (*Int) CmpAbs

func (i *Int) CmpAbs(y *Int) int

func (*Int) Div

func (i *Int) Div(x, y *Int) *Int

func (*Int) DivMod

func (i *Int) DivMod(x, y, m *Int) (*Int, *Int)

func (*Int) Exp

func (i *Int) Exp(x, y, m *Int) *Int

func (*Int) Format

func (i *Int) Format(s fmt.State, ch rune)

func (*Int) GCD

func (i *Int) GCD(x, y, a, b *Int) *Int

func (*Int) Go

func (i *Int) Go() *big.Int

Go converts "gabi/big".Int to a "math/big".Int

func (*Int) Int64

func (i *Int) Int64() int64

func (*Int) IsInt64

func (i *Int) IsInt64() bool

func (*Int) IsUint64

func (i *Int) IsUint64() bool

func (*Int) Lsh

func (i *Int) Lsh(x *Int, n uint) *Int

func (*Int) MarshalBinary

func (i *Int) MarshalBinary() ([]byte, error)

func (*Int) MarshalText

func (i *Int) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler, returning the base64-encoding of i.Bytes().

func (*Int) MarshalXML

func (i *Int) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Int) Mod

func (i *Int) Mod(x, y *Int) *Int

func (*Int) ModInverse

func (i *Int) ModInverse(g, n *Int) *Int

func (*Int) ModSqrt

func (i *Int) ModSqrt(x, p *Int) *Int

func (*Int) Mul

func (i *Int) Mul(x, y *Int) *Int

func (*Int) MulRange

func (i *Int) MulRange(a, b int64) *Int

func (*Int) Neg

func (i *Int) Neg(x *Int) *Int

func (*Int) Not

func (i *Int) Not(x *Int) *Int

func (*Int) Or

func (i *Int) Or(x, y *Int) *Int

func (*Int) ProbablyPrime

func (i *Int) ProbablyPrime(n int) bool

func (*Int) Quo

func (i *Int) Quo(x, y *Int) *Int

func (*Int) QuoRem

func (i *Int) QuoRem(x, y, r *Int) (*Int, *Int)

func (*Int) Rand

func (i *Int) Rand(rnd *rand.Rand, n *Int) *Int

func (*Int) Rem

func (i *Int) Rem(x, y *Int) *Int

func (*Int) Rsh

func (i *Int) Rsh(x *Int, n uint) *Int

func (*Int) Set

func (i *Int) Set(x *Int) *Int

func (*Int) SetBit

func (i *Int) SetBit(x *Int, j int, b uint) *Int

func (*Int) SetBits

func (i *Int) SetBits(abs []big.Word) *Int

func (*Int) SetBytes

func (i *Int) SetBytes(buf []byte) *Int

func (*Int) SetInt64

func (i *Int) SetInt64(x int64) *Int

func (*Int) SetString

func (i *Int) SetString(s string, base int) (*Int, bool)

func (*Int) SetUint64

func (i *Int) SetUint64(x uint64) *Int

func (*Int) Sign

func (i *Int) Sign() int

func (*Int) Sqrt

func (i *Int) Sqrt(x *Int) *Int

func (*Int) String

func (i *Int) String() string

func (*Int) Sub

func (i *Int) Sub(x, y *Int) *Int

func (*Int) Text

func (i *Int) Text(base int) string

func (*Int) Uint64

func (i *Int) Uint64() uint64

func (*Int) UnmarshalBinary

func (i *Int) UnmarshalBinary(buf []byte) error

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler. If the input is quoted it attempts a base64 -> []byte -> Int conversion using i.SetBytes(). Otherwise, it attempts to unmarshal the input as a JSON base 10 big integer.

func (*Int) UnmarshalXML

func (i *Int) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements xml.Unmarshaler, attempting to parse the text of the specified element as a base 10 integer.

func (*Int) Xor

func (i *Int) Xor(x, y *Int) *Int

Jump to

Keyboard shortcuts

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