hcrypto.engines
Class SubstitutionKey

java.lang.Object
  |
  +--hcrypto.cipher.HistoricalKey
        |
        +--hcrypto.engines.SubstitutionKey

public class SubstitutionKey
extends HistoricalKey

This class represents a key for a Simple Substitution cipher. The key is entirely represented by a keyword, which which is inserted at the beginning of a SubstitutionAlphabet. For example, the keyword "ralph" would begin the substitution alphabet and the remaining letters would would follow in their natural progression: "ralphbcdefgijkmnoqstuvwxyz".

See also:


SubstitutionEngine
Alphabet


Field Summary
static java.lang.String DEFAULT_KEY_DESCRIPTOR_PROMPT_STRING
          A prompt for the keyword
static java.lang.String DEFAULT_KEYWORD_STRING
          A default keyword.
 
Fields inherited from class hcrypto.cipher.HistoricalKey
alphabet, blocksize, ciphAlphabet, cipherAlphabet, keyDescriptorPrompt, keyspec, keyword, plainAlphabet
 
Constructor Summary
SubstitutionKey()
           
 
Method Summary
 java.lang.String getAlgorithm()
          Returns the algorithm name "Substitution".
 void init(java.lang.String keyspec)
          Creates a SubstitutionKey with the specified keyspec.
 
Methods inherited from class hcrypto.cipher.HistoricalKey
getAlphabet, getBlocksize, getCiphAlphabet, getCTAlphabet, getInstance, getKeyDescriptorPrompt, getKeyword, getPlainAlphabet, initAlphabets, initKey, printAlphabets, removeDuplicateChars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 prompt for the keyword

DEFAULT_KEYWORD_STRING

public static final java.lang.String DEFAULT_KEYWORD_STRING
A default keyword.
Constructor Detail

SubstitutionKey

public SubstitutionKey()
Method Detail

init

public void init(java.lang.String keyspec)
          throws java.lang.Exception
Creates a SubstitutionKey with the specified keyspec.
Overrides:
init in class HistoricalKey
Parameters:
keySpec - takes the form "keyword/alphabet", i.e. "76TrombonesLEDTHEBIGPARADE/az+AZ+09" for example, which would be mapped into the instance variables keyword as a String with the value of "76TrombonesLEDTHEBIGPARADE", and alphabet as a String with the value "azAZ09".

getAlgorithm

public java.lang.String getAlgorithm()
Returns the algorithm name "Substitution".
Overrides:
getAlgorithm in class HistoricalKey