Module helpers

Module helpers 

Source
Expand description

A set of helpers functions.

Constants§

REGULAR_ALPHABET
The 26-letter alphabet we know and love in the Western part of the world
SC_ALPHABET
Default alphabet containing A-Z plus special characters ‘/’ and ‘-’. The ‘/’ character is used as a digit escape marker in encryption.

Functions§

by_n
Inserts a space every n characters in a string.
condense
Removes all duplicate characters from a string, preserving the first occurrence of each.
condense_str
Efficiently removes all duplicate characters from a string, returning a new String.
expand
Expands a byte slice by inserting ‘X’ between consecutive duplicate characters.
fix_double
Replaces consecutive identical characters by inserting a fill character between them.
fix_double_aligned
Replaces consecutive identical characters by inserting a fill character between them, but only when the duplicate pair falls on a 2-character boundary.
insert
insert one character inside the array
output_as_block
Formats a string into blocks of 5 characters separated by spaces.
shuffle
Shuffles an alphabet using a keyword to create a mixed alphabet for cipher use.
to_numeric
Converts a string key into a numeric representation based on alphabetical order.
transp_shuffle
Shuffles an alphabet using a keyword to create a mixed alphabet for cipher use.