algos

package
v0.0.0-...-8c637cd Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package algos implements the set of supported algorithms for the package github.com/zedseven/steg.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlgoAddressor

func AlgoAddressor(algo Algo, seed, channels int64, bitsPerChannel uint8) (func() (int64, error), error)

AlgoAddressor facilitates running different algorithm addressors at runtime based on a provided algo value.

func PatternAddressor

func PatternAddressor(seed, channels int64, bitsPerChannel uint8) func() (int64, error)

PatternAddressor is an algorithm that returns unique, random addresses in the range of 0 to Max.

func SequentialAddressor

func SequentialAddressor(channels int64, bitsPerChannel uint8) func() (int64, error)

SequentialAddressor is an algorithm that works sequentially, from 0 to Max.

Types

type Algo

type Algo int

Algo is used to define the various algorithm types supported by the package.

const (
	// AlgoUnknown is an unknown algorithm type.
	AlgoUnknown Algo = iota
	// AlgoSequential is an algorithm that works sequentially, from 0 to Max.
	AlgoSequential Algo = iota
	// AlgoPattern is an algorithm that returns unique, random addresses in the range of 0 to Max.
	AlgoPattern Algo = iota
)

func StringToAlgo

func StringToAlgo(str string) Algo

StringToAlgo simply parses a string into an algorithm type, or AlgoUnknown if the string is not recognized.

func (Algo) IsValid

func (algo Algo) IsValid() bool

IsValid simply determines whether a given algorithm is valid.

func (Algo) String

func (algo Algo) String() string

String returns the name of the algorithm, or "<unknown>" if unknown.

type EmptyPoolError

type EmptyPoolError struct{}

EmptyPoolError is thrown when an algorithm addressor is called but it's pool of available addresses to hand out is empty.

func (EmptyPoolError) Error

func (e EmptyPoolError) Error() string

Error returns a string that explains the EmptyPoolError.

type UnknownAlgoError

type UnknownAlgoError struct {
	// Algorithm is the algorithm provided that is unknown to the package.
	Algorithm Algo
}

UnknownAlgoError is thrown when an unknown algorithm type is provided.

func (UnknownAlgoError) Error

func (e UnknownAlgoError) Error() string

Error returns a string that explains the UnknownAlgoError.

Jump to

Keyboard shortcuts

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