hcrypto.engines
Class TranspositionKey

java.lang.Object
  extended by hcrypto.cipher.HistoricalKey
      extended by hcrypto.engines.TranspositionKey

public class TranspositionKey
extends HistoricalKey

Represents a key for a Transposition cipher. The key is entirely represented by a keyword, a String with a set of positive contiguous integers always including zero: such as "2013".

For this implementation of Transposition cipher any of the alphabet ranges can be used.

See also:


TranspositionKey
Alphabet


Field Summary
static java.lang.String DEFAULT_KEY_DESCRIPTOR_PROMPT_STRING
          A keyword description.
static java.lang.String DEFAULT_KEYWORD_STRING
          A default key.
 
Constructor Summary
TranspositionKey()
           
 
Method Summary
 java.lang.String getAlgorithm()
          Returns the name of the algorithm "Transposition".
 java.lang.String getInvertedKeyword()
          Returns the inverted keyword.
 void init(java.lang.String keyspec)
          Initializes the TranspositionKey with the specified keyspec.
 void init(java.lang.String keyword, Alphabet alpha1, Alphabet alpha2)
          Initializes the TranspositionKey given a keyword and one or more alphabets.
 
Methods inherited from class hcrypto.cipher.HistoricalKey
getAlphabet, getBlocksize, getCipherKey, getCTAlphabet, getInstance, getKeyDescriptorPrompt, getKeyword, getPlainKey, initKey, initKey, invertKey, printAlphabets, removeDuplicateChars
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_KEY_DESCRIPTOR_PROMPT_STRING

public static final java.lang.String DEFAULT_KEY_DESCRIPTOR_PROMPT_STRING
A keyword description.

See Also:
Constant Field Values

DEFAULT_KEYWORD_STRING

public static final java.lang.String DEFAULT_KEYWORD_STRING
A default key.

See Also:
Constant Field Values
Constructor Detail

TranspositionKey

public TranspositionKey()
Method Detail

init

public void init(java.lang.String keyspec)
          throws java.lang.Exception
Initializes the TranspositionKey with the specified keyspec.

Specified by:
init in class HistoricalKey
Parameters:
keySpec - takes the form "keyword/alphabet", i.e. "2013/az+AZ+09" for example, which would be mapped into the instance variables keyword as a String with the value of "2013", and alphabet as a String with the value "az+AZ+09".
Throws:
java.lang.Exception

init

public void init(java.lang.String keyword,
                 Alphabet alpha1,
                 Alphabet alpha2)
          throws java.lang.Exception
Initializes the TranspositionKey given a keyword and one or more alphabets.

Specified by:
init in class HistoricalKey
Parameters:
keyword - -- a string version of the keyword
alpha1, - alpha2 -- Alphabets for plain/ciphertext respectively. May be identical.
Throws:
java.lang.Exception

getAlgorithm

public java.lang.String getAlgorithm()
Returns the name of the algorithm "Transposition".

Specified by:
getAlgorithm in class HistoricalKey

getInvertedKeyword

public java.lang.String getInvertedKeyword()
Returns the inverted keyword.