Documentation ¶
Overview ¶
Package cryptipass v1.3.0 provides functionality for generating secure passphrases composed of random words, with a focus on cryptographic security and entropy calculation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenMixWord ¶
GenMixWord generates a single word of random length and returns it along with its entropy. The word length is determined by the PickLength function, and the word itself is generated by the GenWord function.
- Return values: string: The generated word of random length. float64: The entropy contributed by both the word length and the word itself.
func GenWord ¶
GenWord generates a word of exactly n characters and returns it along with the entropy associated with the process. The characters are selected by calling PickNext iteratively until the word reaches the desired length.
Parameters: n (int): The number of characters to include in the generated word.
Return values: string: The generated word consisting of n characters. float64: The total entropy contributed by the character selection process.
func NewPassphrase ¶
NewPassphrase generates a passphrase consisting of the specified number of random words. Each word is chosen by the GenMixWord function, and the total entropy of the passphrase is calculated and returned along with the passphrase.
Parameters: words (uint64): The number of words to include in the passphrase.
Return values: string: The generated passphrase, with words joined by periods. float64: The total entropy (in bits) of the passphrase, indicating its strength.
func PickLength ¶ added in v1.2.0
PickLength returns a random word length and its associated entropy. The word length is chosen based on a weighted random selection, with lengths ranging from 3 to 9 characters.
- Return values: int: The selected word length in characters. float64: The entropy contributed by the length selection process.
func PickNext ¶ added in v1.2.0
PickNext appends the next character to the current seed string based on specific rules. It evaluates the last two characters of the seed to decide on the next character, either through predefined cases (such as 'mh' becoming 'mho') or randomly selecting a new character with associated entropy.
Parameters: seed (string): The current string being used to generate the passphrase.
Return values: string: The updated string after appending the next character. float64: The entropy contributed by the character selection process.
Types ¶
This section is empty.