NAME

cadenus - Create and manipulate a cadenus cipher

SYNOPSIS

set cipherProc [cipher create cadenus]

cipherProc configure ?options?
cipherProc cget option
cipherProc restore key order
cipherProc rotate col|all|key offset
cipherProc fit ?column1 column2?
cipherProc swap col1 col2
cipherProc undo
cipherProc solve

DESCRIPTION

cipherProc configure ?options?
Configure the settings for the cadenus 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 -period n
Since the period of a cadenus cipher is based on the ciphertext length, this option has no effect.

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

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 -period
Return the period for this cipher.

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

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 [lindex $key 0] [lindex $key 1]

cipherProc rotate col|all|key offset
This command allows you to adjust the key value for one or more columns. In the first case, a single column can be rotated up or down by the specified offset. Positive values shift all letters in the column up, negative values shift the letters down.

The all argument specifies that all columns are to be rotated by the same offset.

The key argument adjusts the position of each column, so that each is moved to the right by the given offset. Columns shifted off the right end are wrapped to the left side. Diagramatically this appears as:

cipherProc rotate key 1

has the following effect on the ciphertext:
Before After
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc
abcd dabc

cipherProc fit ?column1 column2?
The fit command attempts to slide the second column against the first until it finds the best digram frequency count for those two columns. The letters in the first column are used for the first letter in each digram, and the second column provides the final letter of each digram. The two columns do not need to be adjacent in order to perform this operation. This routine adjusts the current key to the best match when it returns.

cipherProc swap column1 column2
Swap the two specified columns.

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

cipherProc solve
Iterate through all (period !) combinations of possible keys. The key that produces plaintext with the highest digram frequency count is used as the solution.

Back to the Index
wart@kobold.org
Created on Wed Mar 31 08:18:25 PST 2004
SourceForge.net Logo