homophonic - Create and manipulate a homophonic cipher


set cipherProc [cipher create homophonic]

cipherProc configure ?options?
cipherProc cget option
cipherProc restore key
cipherProc substitute ct pt
cipherProc undo
cipherProc locate tip ?ct?
cipherProc solve


cipherProc configure ?options?
Configure the settings for the homophonic cipher. Valid options are:

cipherProc configure -ciphertext string
cipherProc configure -ct string
Set the ciphertext for this cipher instance to string. Invalid letters or numbers in the ciphertext are silently discarded.

cipherProc configure -language language
This option is currently ignored for all cipher types. Set the current cipher language to language. If the cipher has a solve method then digram frequencies for this language are used to determine the best fit. If the language is not specified or not known then english is used.

cipherProc cget option
Look up the value for a given option. Valid options are:

cipherProc cget -type
Returns the type of this cipher. In this case, homophonic

cipherProc cget -ciphertext
cipherProc cget -ct
Return the ciphertext for this cipher.

cipherProc cget -plaintext
cipherProc cget -pt
Return the plaintext for this cipher based on the current key setting.

cipherProc cget -key
Returns the current key setting for this cipher. The result can be passed back to this cipher instance or another cipher with the cipherProc restore subcommand.

cipherProc cget -length
Returns the length of the ciphertext for this cipher. 0 is returned if the ciphertext has not been set.

cipherProc cget -language
Returns the name of the language used for this cipher.

cipherProc cget -intlength
Returns the number of ciphertext values. Since each pair of ciphertext digits represents a single plaintext letter, this will be half of the ciphertext length.

cipherProc cget -histogram

cipherProc cget -fullkey

cipherProc cget -period
Return the period for this cipher.

cipherProc substitute ct pt
Substitute the numerical pairs ct with the plaintext values in pt. An invalid substitution will generate an error. For example:

cipherProc substitute 0102 aa

causes conflicting substitutions (01 -> a and 02 -> a).

cipherProc restore key
The restore command restores the cipher's key to a previously stored state. The output from cipherProc cget -key can be passed back into the restore command to implement a crude save feature. Example:

set key [$firstCipher cget -key]
$secondCipher restore $key

cipherProc undo
Clears all changes that have been made to the ciphertext.

cipherProc locate tip ?ct?
Drag the tip along the ciphertext until a valid substitution is found. If ct is specified then the tip dragging starts at the first occurrence of ct in the ciphertext.

cipherProc solve
Iterate through all 4 keyed alphabets. The key letter for each alphabet is the one that produces the letter frequency distribution that best matches English.

Back to the Index
Created on Wed Mar 31 08:18:25 PST 2004 Logo