Page 2 of 8 <12345>Last »
Topic Options
#123692 - 2004-07-25 07:16 AM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
k, code working fine until whitespace occurs.
after that, totally messed up. even the length is different.
_________________________
!

download KiXnet

Top
#123693 - 2004-07-25 08:10 AM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
totally out there.
anyone had any luck with the multi-word shifting?
getting frustrated. can't even see where it gets screwed up.
_________________________
!

download KiXnet

Top
#123694 - 2004-07-25 09:21 AM Re: KiXgolf: Vigenere Cipher - Private coding
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3164
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 Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
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
#123696 - 2004-07-25 01:37 PM Re: KiXgolf: Vigenere Cipher - Private coding
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Time to play,

will try to understand the rules and use pen&paper first.


Like Schwarzenegger said: I'll be back.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#123697 - 2004-07-25 02:20 PM Re: KiXgolf: Vigenere Cipher - Private coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
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
#123698 - 2004-07-25 02:51 PM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
Quote:

... the first "the" would use the cipher tableau starting as
Code:

ABC...
BCD..


and the second cipher tableau would start with
Code:

BCD...
CDE...

...




does not sound correct.
the second tableau has no offset defined in the rules so the first row should be identical to the one in the first word.
_________________________
!

download KiXnet

Top
#123699 - 2004-07-25 02:54 PM Re: KiXgolf: Vigenere Cipher - Private coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Yeah, good spot. I'll correct it. Thanks.
_________________________
There are two types of vessels, submarines and targets.

Top
#123700 - 2004-07-25 03:46 PM Re: KiXgolf: Vigenere Cipher - Private coding
krabourn Offline
Hey THIS is FUN
*****

Registered: 2000-12-11
Posts: 244
Loc: San Antonio, Texas, USA
This may be obvious, but I want to make sure I understand. Essentially, we are to pass through anything that is not A-Z,a-z,0-9.
_________________________
Kelly

Top
#123701 - 2004-07-25 03:54 PM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
jens, not totally sure but this seems to not work at all.
not my code but the rules.

if you have input string which has in second word "K" and at the same position in the cipher "I", you encrypt it with "M"
when you decrypt it, the first "M" in the tableau is for "2"
I thought I was messing things up but it is really clearly in the tableau.
oh, and this was without lower case with input of:
$iRC=vigenere("KIXGOLF KIXGOLF","KIXGOLF") ?? $iRC ????
vigenere($iRC,"KIXGOLF",1) ?

if my case proves right, I have good code at 649 strokes.
I have been looking at the second word table all night and this is the only conclusion I found why the code fails.
do you have any prove that it can work?
_________________________
!

download KiXnet

Top
#123702 - 2004-07-25 03:58 PM Re: KiXgolf: Vigenere Cipher - Private coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Quote:

Essentially, we are to pass through anything that is not A-Z,a-z,0-9.



Yes, that is correct.
_________________________
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 Offline
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

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#123704 - 2004-07-25 04:24 PM Re: KiXgolf: Vigenere Cipher - Private coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Crypto=keyword
_________________________
There are two types of vessels, submarines and targets.

Top
#123705 - 2004-07-25 04:58 PM Re: KiXgolf: Vigenere Cipher - Private coding
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
I guess I have to owe you all an apology. Jooel actually found a problem in the underlying rules with regards to the shifting of letters. when applying the shifts, the cypher table is no longer symmetric, thus one would get ambiguous results during the decryption process. Thus, the decryption process breaks for e.g. the second word.

However, here's the remedy. instead of applying the word-number offset to the rows of the cipher table this word-number offset will be applied to the encrypted character, e.g. encrypted character 'A' with word-offset '1' (first word) results in 'B', and encrypted letter 'b' with word-offset '2' (second word) results in 'C'.

I put a demo cipher process below. I will also change toe rules to reflect this.

Cipher tableau for the second word in a two-word sentence.

Code:

0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

0 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0
2 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1
3 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2
4 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3
5 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4
6 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5
7 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6
8 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7
9 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8
A A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9
B B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A
C C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B
D D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C
E E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D
F F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E
G G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F
H H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G
I I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H
J J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I
K K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J
L L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K
M M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L
N N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M
O O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N
P P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O
Q Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
R R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q
S S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R
T T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S
U U V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T
V V W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U
W W X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V
X X Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W
Y Y Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X
Z Z 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y




keyword : KIXTART
plain : KIXTART
ciphertext : 62WOMKO


keyword : KIXTART
ciphertext : 62WOMKO
Ciphertext-Offset : 40UMKIM
plain : KIXTART
_________________________
There are two types of vessels, submarines and targets.

Top
#123706 - 2004-07-25 11:38 PM Re: KiXgolf: Vigenere Cipher - Private coding
Howard Bullock Offline
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)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#123707 - 2004-07-26 01:35 AM Re: KiXgolf: Vigenere Cipher - Private coding
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3164
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 Offline
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.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#123709 - 2004-07-26 09:49 AM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
lol!

jens, not sure do I understand the new ruling so good but I have all work day to think about it before I get home and back coding...
_________________________
!

download KiXnet

Top
#123710 - 2004-07-26 10:13 AM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
ja, lot simpler. just had to read the rules properly.
I have the code for this already at home, just need to get there :@

gladly all you americano's are sleeping
_________________________
!

download KiXnet

Top
#123711 - 2004-07-26 05:12 PM Re: KiXgolf: Vigenere Cipher - Private coding
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
blaah.
"? $iValidPercent" is totally useless in your kixgolf.kix
removed it.
also added:
Code:
if instr(@scriptexe,"WKIX")

?"press any key to close"
get $sOutput
endif



just before:
Code:
  exit 0


; any modifications below this line will result in immediate disqualification


_________________________
!

download KiXnet

Top
Page 2 of 8 <12345>Last »


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 159 anonymous users online.
Newest Members
emnipetro, Hirze, thequeen, ameliaryan, shalomsalami
17641 Registered Users

Generated in 0.042 seconds in which 0.012 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org