aristocrat - Create and manipulate a aristocrat cipher


set cipherProc [cipher create aristocrat]

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


cipherProc configure ?options?
Configure the settings for the aristocrat 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 configure -strict true|false
Set the strictness for alternate substitutions. If this is set to true then attempting to override an existing substitution will generate an error. For example, with strict = true, the second statement will fail:
aristocrat sub a b
aristocrat sub a c
The strictness defaults to false

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, aristocrat

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 -period
This always returns 0

cipherProc cget -K1key
Print the key as a K1 keyed alphabet.

cipherProc cget -K2key
Print the key as a K2 keyed alphabet.

cipherProc cget -strict
Get the strictness setting. Returns either 1 or 0.

cipherProc restore ct pt
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 [lindex $key 0] [lindex $key 1]

cipherProc substitute ct pt
Substitute the ciphertext string ct with the plaintext string pt. Conflicting substitutions will raise an error.

cipherProc undo ct
Clears all key entries for the given ciphertext values.

cipherProc locate tip ?ct?
Locate a possible position for the tip in the ciphertext. The tip is dragged along the ciphertext until a valid substitution is found. If the ct argument is specified, the tip is dragged along starting where ct appears in the ciphertext.

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