modulo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: CC0-1.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculator

type Calculator interface {
	N() int64                                        // N returns the positive integer that we're reducing by.
	MultiplyUint64(a uint64, b uint64) uint64        // MultiplyUint64 returns the product (a * b) mod N.
	MultiplyReducedUint64(a uint64, b uint64) uint64 // MultiplyReducedUint64 returns the product (a * b) mod N. Assumes that a and b are already reduced mod N (otherwise the result is undefined).
	MultiplyInt64(a int64, b int64) int64            // MultiplyInt64 returns the product (a * b) mod N.
	MultiplyReducedInt64(a int64, b int64) int64     // MultiplyReducedInt64 returns the product (a * b) mod N. Assumes that a and b are already reduced mod N (otherwise the result is undefined).
}

Calculator is the interface satisfied by an object able to perform arithmetic modulo n.

func New

func New(n int64) Calculator

New returns a new calculator for the given value of n. Requires that n is a positive integer, otherwise this will panic.

Jump to

Keyboard shortcuts

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