Documentation ¶
Overview ¶
Package keygen is a library to generate keys
Index ¶
- Constants
- func CalculateProbability(s string, caseSensitive bool) int64
- func HumanizeDuration(duration time.Duration) string
- func InvalidSearchMsg(s string) string
- func IsRegex(s string) bool
- func IsValidRegex(s string) string
- func IsValidSearch(s string) bool
- func NumberFormat(n int64) string
- func Plural(s string, v int64) string
- type Cruncher
- type Key
- type Options
- type Pair
- type PrivateKey
Constants ¶
const KeySize = 32
KeySize defines the size of the key
Variables ¶
This section is empty.
Functions ¶
func CalculateProbability ¶
CalculateProbability calculates the probability that a string can be found. Case-insensitive letter matches [a-z] can be found in upper and lowercase combinations, so have a higher chance of being found than [0-9], / or +, or case-sensitive matches.
func HumanizeDuration ¶
HumanizeDuration returns a human-readable output of time.Duration
func InvalidSearchMsg ¶
InvalidSearchMsg returns the error message the search term contains invalid characters
func IsValidRegex ¶
IsValidRegex checks the regex has any chance of matching a key
func IsValidSearch ¶
IsValidSearch checks the search does not contain any invalid characters
func NumberFormat ¶
NumberFormat returns a number-formatted string, eg: 1,123,456
Types ¶
type Cruncher ¶
type Cruncher struct { Options WordMap map[string]int RegexpMap map[*regexp.Regexp]int Abort bool // set to true to abort processing // contains filtered or unexported fields }
Cruncher struct
func (*Cruncher) CalculateSpeed ¶
CalculateSpeed returns average calculations per second based on the time per run taken from 2 seconds runtime.
func (*Cruncher) CollectToSlice ¶
CollectToSlice will run till all the matching keys were calculated. This can take some time
type PrivateKey ¶
PrivateKey is curve25519 key. It is used by WireGuard to represent private keys.
func (*PrivateKey) Public ¶
func (k *PrivateKey) Public() Key
Public computes the public key matching this curve25519 secret key.
func (*PrivateKey) String ¶
func (k *PrivateKey) String() string
String returns a private key as a string