#123694 - 2004-07-25 09:21 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Bryce
KiX Supporter
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
ahh cool!! i think i got it working, and only took a few extra lines
But i do have a question.... the multi work shift? I am not 100% clear on that. Or i am seeing some weird results..
what happens if the shift size is greater than the length of the word?
|
Top
|
|
|
|
#123695 - 2004-07-25 10:48 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
if someone wants a table for checking the correctness of the data, here is some code for creating the tables for 1st and 2nd word of sentence: Code:
$l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" $x=$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l+$l
for $=1 to len($l) substr($l,$,1) " " substr($l,$) left($l,$-1) ? next ??? for $=1 to len($l) substr($l,$,1) " " substr($x,$*2-1,len($l)) ? next
get $
like you can see, the cipher has the clear flaw that with same key char a crypted char may have multiple matches. that makes this cipher theoretically useless.
_________________________
!download KiXnet
|
Top
|
|
|
|
#123697 - 2004-07-25 02:20 PM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Sealeopard
KiX Master
Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
|
Yeah, Jooel found the flaw. Under certain circumstances, when the plain text contains a lower-case character and the cipher key does not, the resulting output text might not contain lower-case characters. In that case, the decryption routine would only work with a cipher tableau containing numeric and upper-case alpha charatcers and fail to properly decrypt the text.
Re: word shift. Just think of each word as it's own little encryption/decryption task with it's own cipher tableau. Since whitespace is passed through the en/de-cryption routines, the output will contain the same number of words as the input. Thus, the way the characters shift from the first cipher tableau to the second cipher tableau are maintained as well. The result is if I for example encrypt "the the", the the first "the" would use the cipher tableau starting as
Code:
ABC...
BCD..
and the second cipher tableau would start with
Code:
ABC...
CDE...
Each "the" would end up with it's own decrypted text even though we only used a single cipher key (actually, we did use two, as the definition of the character shift based on the number of words can be considered a second key).
BTW, Richard H.s Vigenere UDF is prepared to handle these different cipher tableaus.
Quote:
what happens if the shift size is greater than the length of the word?
The shift should not have any relations to the length of a single word. Each word is encrypted with it's own cipher tableau that is constructed based on the position of the word inside the sentence.
Edited by sealeopard (2004-07-25 02:54 PM)
_________________________
There are two types of vessels, submarines and targets.
|
Top
|
|
|
|
#123703 - 2004-07-25 04:23 PM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Quote:
The lower-case cipher block will only be used if lower-case characters are present in the plain, crypto, or cipher text.
What is "crypto"? Are you referring to the "Keyword?
Code:
Keyword: RELAT IONSR ELATI ONSRE LATIO NSREL Plaintext: TOBEO RNOTT OBETH ATIST HEQUE STION Ciphertext: KSMEH ZBBLK SMEMP OGAJX SEJCS FLZSY
|
Top
|
|
|
|
#123706 - 2004-07-25 11:38 PM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
[edit] My shifting altered the entire table so that each word was encrypted with a different table. The entire table shifted by the required offset. By shifting the first row, then processing the the balance of the table, this methodology provides a working solution but was not the exact specification Jens had requested.
I therefore am voiding this post as it does not conform to the challenge.
[/edit]
Hmmm. I seem to have gotten it to work with the original rules.
[CODE]
KiXtart
KiXtart Version = 4.22
KiXforms Version =
KiXGolf Script = kixgolf_vigenere.kix
Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 848 MHz
Memory = 512 MB
KiXGolf Scoring Engine
Scoring Engine = 3.0.3
KiXtart Golf Score
Tournament = KiXtart Golf: Vigenere Cipher
Valid Cipher Ops = 9 (100%)
Processing Start = 2004/07/25 17:24:51.432
Processing End = 2004/07/25 17:25:15.038
Duration = 0000/00/00 00:00:23.605
KiXGolf Score = 853
Thank you for participating in KiXtart Golf!
[/CODE]
Edited by Howard Bullock (2004-07-26 06:37 AM)
|
Top
|
|
|
|
#123707 - 2004-07-26 01:35 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Bryce
KiX Supporter
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
are you sure??
i had code that was passing with a 100% and a score of 447. But the errors inharrent in the original cipher table, were causing weird decryption errors, and they were starting to drive me nuts. But i could not figure out what was happeneing
|
Top
|
|
|
|
#123708 - 2004-07-26 05:15 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I have output the input string and the decoded string. They all match...
But after having a beer with Jens and discussing this, I do believe that my code did not implement the the shifting properly. I am revisiting the code now.
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 498 anonymous users online.
|
|
|