Documentation
¶
Overview ¶
Package transform contains logic for transforming input maps
Index ¶
- func GeneratePassphrase(passWords map[string]int, transformationFilesMap map[string]int, ...) string
- func MakePassphraseMap(input map[string]int, transformationFilesMap map[string]int, bypass bool, ...) map[string]int
- func ReplaceKeysInMap(originalMap map[string]int, replacements map[string]int, bypass bool, ...) map[string]int
- func TransformationController(input map[string]int, mode string, startingIndex int, endingIndex int, ...) (output map[string]int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePassphrase ¶ added in v0.2.1
func GeneratePassphrase(passWords map[string]int, transformationFilesMap map[string]int, passphraseWord int) string
GeneratePassphrase takes a key and a map of transformation files and generates a passphrase based on the number of words specified. The words are selected from the transformation files and concatenated together with a separator. If the replacement mask is set to blank, then the words are concatenated together without any separators.
Args:
passWords (map[string]int): Content of the passphrase for use as words in the passphrase transformationFilesMap (map[string]int): Content of the transformation files for use as separators between words passphraseWord (int): The number of words to use for passphrase generation
Returns:
(string): The generated passphrase
func MakePassphraseMap ¶ added in v0.2.1
func MakePassphraseMap(input map[string]int, transformationFilesMap map[string]int, bypass bool, debug bool, passphraseWord int) map[string]int
MakePassphraseMap takes a map of keys and creates a new map with new passphrases for each key. The transformation file is used to insert separators between the words. If the replacement mask is set to blank, then the words are concatenated together without any separators. Passphrases are generated by selecting a random word from the transformation file for each key.
Args:
input (map[string]int): The original map to replace keys in transformationFilesMap (map[string]int): A map of transformation files to use for constructing the passphrases bypass (bool): If true, the map is not used for output or filtering debug (bool): If true, print additional debug information to stderr passphraseWord (int): The number of words to use for passphrase generation
Returns:
(map[string]int): A new map with the keys replaced
func ReplaceKeysInMap ¶
func ReplaceKeysInMap(originalMap map[string]int, replacements map[string]int, bypass bool, debug bool) map[string]int
ReplaceKeysInMap takes a map of keys and values and replaces the keys with replacements based on the replacement map. This is useful for exact key swaps.
Args:
originalMap (map[string]int): The original map to replace keys in replacements (map[string]int): The map of replacements to use bypass (bool): If true, the map is not used for output or filtering debug (bool): If true, print additional debug information to stderr
Returns:
(map[string]int): A new map with the keys replaced
func TransformationController ¶
func TransformationController(input map[string]int, mode string, startingIndex int, endingIndex int, verbose bool, replacementMask string, transformationFilesMap map[string]int, bypass bool, debug int, passphraseWord int) (output map[string]int)
TransformationController is the main entry point for the CLI application. Operates a switch statement to determine the mode to use.
Args:
input (map[string]int): A map of input values mode (string): The mode to run the CLI in startingIndex (int): The starting index for the transformation if applicable endIndex (int): The ending index for the transformation if applicable verbose (bool): If true, the verbose information is printed when available replacementMask (string): The mask characters to use for masking operations transformationFilesMap (map[string]int): A map of transformation files to use for modes like retain-mask bypass (bool): If true, the map is not used for output or filtering debug (int): Different debug levels to use for debugging [0-2] passphraseWord (int): The number of words to use for passphrase generation
Returns:
(map[string]int): A map of transformed values
Types ¶
This section is empty.