NAME

bazeries - Create and manipulate a bazeries cipher

SYNOPSIS

set cipherProc [cipher create bazeries]

cipherProc configure ?options?
cipherProc cget option
cipherProc swap row|col col1 col2
cipherProc substitute row column value
cipherProc undo ?row col?
cipherProc restore key

DESCRIPTION

cipherProc configure ?options?
Configure the settings for the bazeries 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 -keysequence n
bazeries ciphers are fractionated. Every ciphertext group is reversed. The length of the ciphertext groups are determined by the key sequence. For example, if the key sequence is 347, then the first three ciphertext characters are reversed as a group, then the next 4, then the next 7. After that the sequence repeats, so the following 3 characters are reversed. The American Cryptogram Association constrains the key sequence to be the same as the keyword spelled out in letters. This implementation of the bazeries cipher does not impose that restriction however, so you could have a keyword of logarithm and a key sequence of 123.

cipherProc configure -stepinterval n
Set the display interval while solving to n. The stepcommand procedure will be called for every nth iteration while solving. This is used to provide user feedback while solving is taking place.

cipherProc configure -stepcommand proc
Set the display command while solving to proc. This command will be called for every nth iteration while solving. The arguments for this procedure are:

stepcommand iter key pt

iter is the current iteration number. key is the current value of the key that is being used. pt is the plaintext that is produced with this key.

cipherProc configure -bestfitcommand proc
Set the best fit display command while solving to proc. This command will be called every time a better solution is found while autosolving. The arguments for this procedure are:

bestfitcommand iter key value pt

iter is the current iteration number. key is the current value of the key that is being used. value is the value of the metric used to judge how good this solution is. The value is often a digram or trigram frequency count. pt is the plaintext that is produced with this key.

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

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 -stepinterval
Returns the current value of the stepinterval.

cipherProc cget -stepcommand
Returns the name of the procedure currently set for the stepcommand. An empty string is returned if no stepcommand is set.

cipherProc cget -bestfitcommand
Returns the name of the procedure currently set for the bestfitcommand. An empty string is returned if no bestfitcommand is set.

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

cipherProc swap row|col item1 item2
Swap two rows or columns in the key. Key rows and columns are numbered from 1 to 5 starting with 1 on the left and top sides.

cipherProc swap row 2 5
cipherProc swap col 1 3

cipherProc substitute row column letter
This command performs a substitution in the bazeries key. The key value located in the specified row and column is set to letter.

cipherProc substitute 1 3 e

cipherProc undo ?row column?
This command removes a substitution in the bazeries key. The key value located in the specified row and column is cleared. If row and column are not specified, all key entries are cleared.

cipherProc undo
cipherProc undo 1 3

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


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