CryptoUtils Class Reference

Inheritance diagram for CryptoUtils:
Collaboration diagram for CryptoUtils:

List of all members.


Detailed Description

Base class of all cryptographic and steganographic en- and decipherers with various required attributes and methods.

Author:
jhermes

Public Methods

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

Public Static Methods

static char[] getDefaultAlphabet ()
static char[] getDefaultAlphabetWithoutChar (char ch)
static char[] getTrithemianAlphabet ()
static Map< String, String > trithemianAlphabetReplacements ()

Protected Methods

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

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

Method Details

boolean checkAlphabet ( String  alphabetString,
char[]  defaultAlphabet 
) [protected]

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]

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]

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.
void checkWSDeletion ( String  deleteWhitespace) [protected]

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

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

Returns the alphabet of this crypto component.

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

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.
static char [] getDefaultAlphabet ( ) [static]

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

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

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.
Map<String, String> getReplacements ( )
static char [] getTrithemianAlphabet ( ) [static]

Returns the Trithemian alphabet: abcdefghiklmnopqrstuxyzw.

Returns:
Trithemian alphabet.
String replaceAll ( String  toProcess)

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)

Sets the alphabet of this crypto component.

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

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

Returns:
Tritemian replacement map.

Field Details

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