simplefactor

package
v0.0.0-...-f1b6caa Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: LGPL-2.1 Imports: 4 Imported by: 0

Documentation

Overview

Package simplefactor is a cost function for finding prime factor pair: used to check that it is too difficult for the PSO to find the primes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

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

Creator is used by psokit to create instances of Fun through its interface method Create().

func NewCreator

func NewCreator(p, q, pMin *big.Int) *Creator

NewCreator just returns a Creator of Fun with primes p,q.

func (*Creator) Create

func (c *Creator) Create(sd int64) setpso.Fun

Create creates an instance

type Fun

type Fun struct {
	//NBit is the number of bits used  for the small factor
	Nbit int
	// contains filtered or unexported fields
}

Fun type stores data for tests of a factor of the product pq Giving a cost of 0 if found.

func (*Fun) About

func (f *Fun) About() string

About returns a string description of the contents of Fun

func (*Fun) Constraint

func (f *Fun) Constraint(pre TryData, hint *big.Int) (valid bool)

Constraint attempts to constrain hint possibly using a copy of pre to do this

func (*Fun) CopyData

func (f *Fun) CopyData(dest, src TryData)

CopyData copies src to dest

func (*Fun) Cost

func (f *Fun) Cost(data TryData, cost *big.Int)

Cost returns the remainder after dividing p in to the prime product

func (*Fun) CreateData

func (f *Fun) CreateData() TryData

CreateData creates a empty structure for decoded try

func (*Fun) DefaultParam

func (f *Fun) DefaultParam() *big.Int

DefaultParam gives a default that satisfies constraints

func (*Fun) Delete

func (f *Fun) Delete(i int) bool

Delete hints to the function to remove/replace the ith item

func (*Fun) IDecode

func (f *Fun) IDecode(data TryData, z *big.Int)

IDecode decodes z into d

func (*Fun) MaxLen

func (f *Fun) MaxLen() int

MaxLen returns the number of elements in the subset sum problem

type FunTry

type FunTry = futil.IntTry

FunTry gives the try structure to use

type FunTryData

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

FunTryData is the decoded data structure for a try

func (*FunTryData) Decode

func (d *FunTryData) Decode() string

Decode requests the function to give a meaningful interpretation of p as a Parameters subset for the function assuming p satisfies constraints

type IntFunStub

type IntFunStub = futil.IntFunStub

IntFunStub gives interface to setpso

func New

func New(p, q, pMin *big.Int) *IntFunStub

New creates a new function where p and q are the two prime components that make up the integer to be factorized. pMin is the smallest factor to choose

type Try

type Try = setpso.Try

Try is the try interface used by setpso

type TryData

type TryData = futil.TryData

TryData is the interface for FunTryData used in package futil

Jump to

Keyboard shortcuts

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