|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthcrypto.cipher.CipherEngine
hcrypto.cipher.BlockCipher
hcrypto.engines.SubstitutionEngine
public class SubstitutionEngine
Implements a keyword-based Substitution cipher algorithm for any range of alphabets, including az, AZ, azAZ, azAZ09, printable characters, all ASCII, and any of the Unicode character sets. A plaintext alphabet is retrieved from the SubstitutionKey class and stored in a character array. A cipher alphabet is created by inserting the characters from the keyword into the first elements of the array, followed by all remaining characters in the particular alphabet.
Encryption involves replacing a plaintext character from a given message with a character from the cipher alphabet with the same index. Decrypting works in the reverse order.
plainKey = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,......];
keyword = calm;
cipherAlphabet = [c,a,l,m,b,d,e,f,g,h,i,j,k,n,o,p,......];
engineEncrypt("cab") == "lca"
engineDecrypt("lca") == "cab"
See also:
SubstitutionKey
Alphabet
| Constructor Summary | |
|---|---|
SubstitutionEngine()
Creates a SubstitutionEngine and sets the alphabetRangeOptions instance variable to "111111", which translates to all six alphabet options. |
|
| Method Summary | |
|---|---|
java.lang.String |
engineDecode(java.lang.String s)
Returns an encoded String for the specified String. |
java.lang.String |
engineEncode(java.lang.String s)
Returns an encoded String for the specified String. |
| Methods inherited from class hcrypto.cipher.CipherEngine |
|---|
getAlphabetRangeOptions |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SubstitutionEngine()
| Method Detail |
|---|
public java.lang.String engineEncode(java.lang.String s)
throws java.lang.Exception
s - the String to be encrypted
java.lang.Exception
public java.lang.String engineDecode(java.lang.String s)
throws java.lang.Exception
s - the String to be decrypted
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||