markov

package
v0.0.0-...-93fb3a7 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sum

func Sum(s []nextByte) int

Sum returns the sum of frequencies inside a transition array

Types

type Chain

type Chain struct {
	Ngram int
	Trans map[string]transition
}

Chain represents a Markov chain containing the ngram number and frequency map

func NewChain

func NewChain(ngram int) *Chain

NewChain returns a new Markov Chain model with number of given ngram.

func (*Chain) Add

func (c *Chain) Add(cs ...<-chan Pair)

Add count the number of pairs by inserting them into a frequency map

func (*Chain) Pairs

func (c *Chain) Pairs(in <-chan string) <-chan Pair

Pairs adds the transitions extracted from input string to an output channel

type Generator

type Generator struct {
	Ngram int
	// contains filtered or unexported fields
}

Generator is another representation of Markov chain to generate markov passwords

func NewGenerator

func NewGenerator(c *Chain) *Generator

NewGenerator returns a Markov password generator from the given chain

func (*Generator) Generate

func (g *Generator) Generate(chans int, maxAttempts uint64)

Generate generates new passwords based on trained Markov model and prints passwords in stdout

type Pair

type Pair struct {
	Current string
	Next    byte
}

Pair represents a state transition between a set of one or more bytes and the next byte in the string.

Jump to

Keyboard shortcuts

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