StegCipherUtils Class Reference

Inheritance diagram for StegCipherUtils:
Collaboration diagram for StegCipherUtils:

List of all members.


Detailed Description

Class to analyze steganographical Trithemian Ciphers from Steganographia I-III (III unimplemented so far) and Polygraphia IV. Provides both static methods for analyzing complete word lists and Constructors/non-static Methods to analyze word-by-word.

Author:
jhermes

Public Methods

String getAssembledString ()
Set< Character > getAlphabet ()
void setAlphabet (char[] alphabet)
String replaceAll (String toProcess)
Map< String, String > getReplacements ()

Public Static Methods

static String assembleSignificantLetters (List< String > words, int pos)
static String assembleSignificantLetters (List< String > words, List< Integer > positions)
static String getPlaintextFromTrithemianIncantation (List< String > words)
static String getPlaintextFromTrithemianSteganographianCipher (List< String > words, boolean[] significantSequence)
static char[] getDefaultAlphabet ()
static char[] getDefaultAlphabetWithoutChar (char ch)
static char[] getTrithemianAlphabet ()
static Map< String, String > trithemianAlphabetReplacements ()

Protected Methods

boolean checkSubstitutes (String substitutesString)
boolean checkAlphabet (String alphabetString, char[] defaultAlphabet)
boolean checkReplacements (String replacementString)
void checkWSDeletion (String deleteWhitespace)
boolean checkIntKey (String intKeyString, int defaultKey)
String getAlphabetAsStringKey (int start)

Protected Attributes

Map< Character, List< String > > wordSubstitutions
char[] alphabet
Map< String, String > replacementMap
int intKey
boolean deleteWhitespace
Logger logger = Logger.getLogger(this.getClass())

Method Details

static String assembleSignificantLetters ( List< String >  words,
int  pos 
) [static]

Static method to assemble significant letters of the specified word List on a String. If the specified position lies outside a word, it will be ignored.

Parameters:
wordswords with significant letters.
posposition of significant letter of each word. Positive ints will be interpreted as position from start, negative from end of each word.
Returns:
String of assembled significant letters
static String assembleSignificantLetters ( List< String >  words,
List< Integer >  positions 
) [static]

Static method to assemble significant letters of the specified word List on a String. Letters will be assembled in order of the specified positions. Positive position Integers will be interpreted as position from start, negative as positions from end of each word. Example: If the Integer List contains {3,-1,4} the significant letter order of the word "trithemius" will be "ist". If one of the specified positions lies outside a word, it will be ignored.

Parameters:
wordswords with significant letters.
positionsof significant letters of each word.
Returns:
String of assembled significant letters
boolean checkAlphabet ( String  alphabetString,
char[]  defaultAlphabet 
) [protected, inherited]

Builds alphabet from specified string, if not null and not empty. Else the specified default alphabet will be set as alphabet.

Parameters:
alphabetStringString to set as alphabet.
defaultAlphabetdefault alphabet.
Returns:
true, if alphabetString can be set as alphabet, false if default alphabet is set.
boolean checkIntKey ( String  intKeyString,
int  defaultKey 
) [protected, inherited]

Builds an integer key from the specified string.

Parameters:
intKeyStringinteger key as string
defaultKeykey to set if integer key could not be build from specified string.
Returns:
true, if int key is builded from specified string, false otherwise.
boolean checkReplacements ( String  replacementString) [protected, inherited]

Builds replacement map from specified string that should be parsable CSV data.

Parameters:
replacementStringreplacements as csv data.
Returns:
true, if replacement map could be build, false otherwise.
boolean checkSubstitutes ( String  substitutesString) [protected]

Builds the word substitution map using specified string. String must contain parsable csv data.

Parameters:
substitutesStringcsv substitute data
Returns:
true, if word substitution map have been build, false otherwise.

Reimplemented in PolygraphiaICipherAnalyzer.

void checkWSDeletion ( String  deleteWhitespace) [protected, inherited]

If specified string equals true, whitespace will be deleted in the substituted text.

Parameters:
deleteWhitespaceboolean value as string
Set<Character> getAlphabet ( ) [inherited]

Returns the alphabet of this crypto component.

Returns:
alphabet of this crypto component.
String getAlphabetAsStringKey ( int  start) [protected, inherited]

Returns the alphabet as string key (starts from the specified position, e.g. 1 for a).

Parameters:
startPosition of the alphabet to start.
Returns:
alphabet as string key.
String getAssembledString ( )

Assembles the significant letters of the specified word.

Parameters:
wordto assemble. Returns the assembled plaintext String.
Returns:
assembled plaintext String.
static char [] getDefaultAlphabet ( ) [static, inherited]

Returns the default alphabet (a-z), lower case letters.

Returns:
default alphabet (a-z).
static char [] getDefaultAlphabetWithoutChar ( char  ch) [static, inherited]

Returns the default alphabet (a-z) without the specified character. Needed e.g. to get 25 letters for a 5 * 5 matrix.

Parameters:
chcharacter to ignore.
Returns:
default alphabet without the specified character.
static String getPlaintextFromTrithemianIncantation ( List< String >  words) [static]

Static method to get the plaintext from a Trithemian incantation of Steganographia I & II.

Parameters:
wordswords of an incantation
Returns:
plaintext from the specified incantation.
static String getPlaintextFromTrithemianSteganographianCipher ( List< String >  words,
boolean[]  significantSequence 
) [static]

Static method to get the plaintext from a Trithemian cipher of Steganographia I & II. Eg. if significantSequence is [true, true, false, false] after two significant words will be deleted two words, if "One Two Three Four Five Six Seven" is the input, "One Two Five Six" will be analyzed, the returned String will be "otfs".

Parameters:
wordswords of the cipher
significantSequencesequence of significant initial letters
Returns:
plaintext of the specified cipher
Map<String, String> getReplacements ( ) [inherited]
static char [] getTrithemianAlphabet ( ) [static, inherited]

Returns the Trithemian alphabet: abcdefghiklmnopqrstuxyzw.

Returns:
Trithemian alphabet.
String replaceAll ( String  toProcess) [inherited]

Replaces characters of the specified string by the replacements set in this.

Parameters:
toProcessString to process.
Returns:
String with replaced characters.
void setAlphabet ( char[]  alphabet) [inherited]

Sets the alphabet of this crypto component.

Parameters:
alphabetto set.
static Map<String,String> trithemianAlphabetReplacements ( ) [static, inherited]

Returns a map of default alphabet values and their replacements in the T. alphabet.

Returns:
Tritemian replacement map.

Field Details

char [] alphabet [protected, inherited]
boolean deleteWhitespace [protected, inherited]
int intKey [protected, inherited]
Logger logger = Logger.getLogger(this.getClass()) [protected, inherited]
Map<String,String> replacementMap [protected, inherited]
Map<Character, List<String> > wordSubstitutions [protected]