PolygraphiaICipherAnalyzer Class Reference

Inheritance diagram for PolygraphiaICipherAnalyzer:
Collaboration diagram for PolygraphiaICipherAnalyzer:

List of all members.


Detailed Description

Class to analyze ciphers based on Trithemius Polygraphia I, II & III substitution. This substitution method is (for the case of P I & II) also known as "Ave Maria Cipher"

Author:
jhermes

Public Types

enum  DecipherMethod {
  PLAYFAIR = ("de.uni_koeln.spinfo.cryptology.cryptanalysis.plaintextgenerators.PlayfairCipherAnalyzer"), POLYBUS = ("de.uni_koeln.spinfo.cryptology.cryptanalysis.plaintextgenerators.PolybusCipherAnalyzer"), CAESAR = ("de.uni_koeln.spinfo.cryptology.cryptanalysis.plaintextgenerators.CaesarCipherAnalyzer"), VIGNERE = ("de.uni_koeln.spinfo.cryptology.cryptanalysis.plaintextgenerators.VignereCipherAnalyzer"),
  ATBASH = ("de.uni_koeln.spinfo.cryptology.cryptanalysis.plaintextgenerators.AtbashCipherAnalyzer"), STEGANOGRAPHIA_I = ("SteganographiaICipherAnalyzer"), STEGANOGRAPHIA_INCANTATION = ("de.uni_koeln.spinfo.cryptology.steganalysis.plaintextgenerators.SteganographiaIncantationAnalyzer"), POLYGRAPHIA_I = ("de.uni_koeln.spinfo.cryptology.steganalysis.plaintextgenerators.PolygraphiaICipherAnalyzer"),
  POLYGRAPHIA_IV = ("de.uni_koeln.spinfo.cryptology.steganalysis.plaintextgenerators.PolygraphiaIVCipherAnalyzer"), POLYGRAPHIA_V = ("de.uni_koeln.spinfo.cryptology.cryptanalysis.plaintextgenerators.PolygraphiaVCipherGenerator")
}
enum  ConfigurationElement {
  KEY = ("Key"), ALPHABET = ("Alphabet"), REPLACEMENTS = ("Replacements"), WORD_SUBSTITUTES = ("Substitutes"),
  DELETE_WHITESPACE = ("Whitespace deletion")
}

Public Methods

 PolygraphiaICipherAnalyzer (List< List< String >> substitutes)
 PolygraphiaICipherAnalyzer (List< List< String >> substitutes, char[] alphabet)
 PolygraphiaICipherAnalyzer (Map< String, Character > substitutes)
 PolygraphiaICipherAnalyzer ()
void configure (Map< ConfigurationElement, String > configurations)
String decipher (String plainText)
String decipher (List< String > words)
String getAssembledString ()
Set< Character > getAlphabet ()
void setAlphabet (char[] alphabet)
String replaceAll (String toProcess)
Map< String, String > getReplacements ()
Map< String, String > getReplacements ()
Set< Character > getAlphabet ()

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())

Member Enumeration Documentation

enum ConfigurationElement [inherited]

Enumeration of potential configuration elements for Cryptologers.

Author:
jhermes
Enumerator:
KEY 
ALPHABET 
REPLACEMENTS 
WORD_SUBSTITUTES 
DELETE_WHITESPACE 
enum DecipherMethod [inherited]

Enumeration of decipher methods.

Author:
jhermes
Enumerator:
PLAYFAIR 
POLYBUS 
CAESAR 
VIGNERE 
ATBASH 
STEGANOGRAPHIA_I 
STEGANOGRAPHIA_INCANTATION 
POLYGRAPHIA_I 
POLYGRAPHIA_IV 
POLYGRAPHIA_V 

Constructors

PolygraphiaICipherAnalyzer ( List< List< String >>  substitutes)

Generates a crypto-analyzer based on the specified list of char-substitutions and the Trithemian alphabet (abcdefghiklmnopqrstuxyzw).

Parameters:
substitutesList of different substitutes lists. Each embedded list contains the substitutes for one character.
PolygraphiaICipherAnalyzer ( List< List< String >>  substitutes,
char[]  alphabet 
)

Generates a crypto-analyzer based on the specified list of substitutions and alphabet. Note that ideally the size of the list corresponds to the size of the alphabet.

Parameters:
substitutesList of different substitutes lists. Each embedded list contains the substitutes for one character.
PolygraphiaICipherAnalyzer ( Map< String, Character >  substitutes)

Generates a crypto-analyzer based on the specified chiffre/substitutionChar map.

Parameters:
substituteschiffre/substitutionChar map.

Generates a crypto-grapher that have to be configured afterwards by call the configure(Map<String,String> configurations) method.


Method Details

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

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, inherited]

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 from StegCipherUtils.

void checkWSDeletion ( String  deleteWhitespace) [protected, inherited]

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

Parameters:
deleteWhitespaceboolean value as string
void configure ( Map< ConfigurationElement, String >  configurations)

Configures the crypto-grapher by the specified configurations. Must be called if this is generated by the non-argument-constructor.

Parameters:
configurations

Implements Cryptologer.

String decipher ( String  cipherText)

Deciphers the specified text.

Parameters:
cipherTexttext to decipher.
Returns:
deciphered text.

Implements Decipherer.

String decipher ( List< String >  words)

Returns the plain text of the specified cipher word sequence.

Parameters:
wordsSequence of words to decipher.
Returns:
plain text.

Implements Decipherer.

Set<Character> getAlphabet ( ) [inherited]

Returns the alphabet of this crypto component.

Returns:
alphabet of this crypto component.
Set<Character> getAlphabet ( ) [inherited]

Returns a set of the alphabet of replacement characters

Returns:
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 ( ) [inherited]

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, inherited]

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, inherited]

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]

Returns a map of the replacements that were used by the component

Returns:
map of replacements
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, inherited]