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".
For this implementation of Substitution cipher any of the alphabet ranges
can be used.
See also:
SubstitutionCipherSpi
Alphabet
Method Summary |
java.lang.String |
getAlgorithm()
Returns the algorithm name "Substitution". |
char[] |
getCipherAlphabet()
Returns the cipher alphabet. |
char[] |
getPlainAlphabet()
Returns the plaintext alphabet. |
void |
init(java.lang.String keyspec)
Creates a SubstitutionKey with the specified keyspec. |
void |
printAlphabets()
Prints both the cipher and plain alphabets to the System console. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_KEY_DESCRIPTOR_PROMPT_STRING
public static final java.lang.String DEFAULT_KEY_DESCRIPTOR_PROMPT_STRING
- A keyword description.
DEFAULT_KEYWORD_STRING
public static final java.lang.String DEFAULT_KEYWORD_STRING
- A default keyword.
SubstitutionKey
public SubstitutionKey()
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/azAZ09" 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
getCipherAlphabet
public char[] getCipherAlphabet()
- Returns the cipher alphabet.
getPlainAlphabet
public char[] getPlainAlphabet()
- Returns the plaintext alphabet.
printAlphabets
public void printAlphabets()
- Prints both the cipher and plain alphabets to the System console.