#123792 - 2004-07-29 11:31 PM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Arghhh! How am I suppose to get there!? 376!! Great job! I may be done. Will look a little tonight.
|
Top
|
|
|
|
#123793 - 2004-07-29 11:33 PM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Actually, I may be disqualified as I provided a new shifted table for each letter and not each word.
|
Top
|
|
|
|
#123796 - 2004-07-30 12:39 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
I think the tester script should be improved a little. talked to mighty-one on msn and it seems that the tester code giving silly false positives is no good.
if someone wants to fill in the blanks, be my quest. anyhow, this is the tester I use and even though it only has one block with cipher text included, it already does a good job beeping on errenous translations.
; KiXtart Golf ; ; break on
; standard KiXgolf variables dim $sGolfScoreUDF, $bGolfScore, $sKiXgolfUDF, $sKiXGolfUDF, $sOutputFile, $bKiXformsRequired dim $sTitle, $iRC, $sKiXGolfScrEngVer, $sKiXformsVer, $objKiXforms dim $sStartTimeDate, $sEndTimeDate, $sRunTime dim $iKiXGolfScore[3], $sOutput, $sResult
; KiXgolf tournament-specific variables ; each Vigenere cipher set consists of the plaintext, the cipher text, and the cipherkey dim $asVigenere[9], $sPlain, $sCipher, $sKey, $iLoop, $sEncrypted, $sDecrypted dim $iValid, $iTotal, $sValidCipherOps, $iValidPercent $asVigenere[0]='KIXGOLF','','KIXGOLF' $asVigenere[1]='KIXGOLF TOURNAMENT','','KIXGOLF' $asVigenere[2]='KIXGOLF TOURNAMENT','','KIXGOLF TOURNAMENT' $asVigenere[3]='KiXgolf','','KiXgolf' $asVigenere[4]='KiXgolf Tournament','','KiXgolf v4.22' $asVigenere[5]='Blaise de Vigenere was born in 1523 and received the normal education of a noble of his period, even though he was not a noble.','','Vigenere Cipher' $asVigenere[6]='The Vigenere cipher basic construction is a combination of a Caesar shift combined with a keyword','gZD QYyXP5ae WJhdVA F3dks FillEnZ6fl5j dr x KLbh2mGqjkB XD i EJewZI eIbpH NqscBrRF 88yT i Globl55','CrYptoGraPhy' $asVigenere[7]='1234567890','','abcdefghijk' $asVigenere[8]='abcdefghij','','1234567890' $asVigenere[9]='Finished!','','Did you win' $iTotal=ubound($asVigenere) $iValid=0
; set required options $sTitle='KiXtart Golf: Vigenere Cipher' $iRC=SETTITLE($sTitle) $iRC=SETOPTION('Explicit','on') $iRC=SETOPTION('NoVarsInStrings','on') $iRC=SETOPTION('WrapAtEOL','on') $iRC=SETOPTION('CaseSensitivity','on')
cls
; define whether KiXforms is required $bKiXformsRequired = 0
if $bKiXformsRequired $objKiXforms=createobject('KiXtart.form') if vartype($objKiXforms)=9 $sKiXformsVer=$objKiXforms.version else $sKiXformsVer='Cannot find KiXforms DLL. The kiXforms DLL is required to participate in KiXgolf.' $sKiXformsVer=$sKiXformsVer+' Please download the KiXforms DLL at http://www.kixforms.org.' $iRC=messagebox($sKiXformsVer,'Cannot find required DLL!',16) endif else $sKiXformsVer='' endif
$sGolfScoreUDF=@scriptdir+'\'+'kixgolf3.udf' if exist($sGolfScoreUDF) call $sGolfScoreUDF $bGolfScore=1 else $bGolfScore=0 endif $sKiXGolfScrEngVer = '3.0.3'
; this is the actual KiXgolf UDF $sKiXGolfUDF=@scriptdir+'\'+left(@scriptname,-3)+'udf' if exist($sKiXGolfUDF) call $sKiXGolfUDF else $iRC=messagebox('Cannot find KiXGolf UDF '+$sKiXGolfUDF,'Cannot find file!',16) exit 2 endif
; initialize official KiXtart Golf Score results file $sOutputFile=@scriptdir+'\'+left(@scriptname,instrrev(@scriptname,'.'))+'txt' $iRC=redirectoutput($sOutputFile,1) ? '[code]' $iRC=redirectoutput('')
; this is the start of the main loop $sStartTimeDate=@DATE+' '+@TIME+'.'+right('000'+@MSECS,3)
for $iLoop=0 to $iTotal $sPlain=$asVigenere[$iLoop] $sCipher=$sPlain[1] $sKey=$sPlain[2] $sPlain=$sPlain[0] if $sPlain if $sCipher $sEncrypted=Vigenere($sPlain,$sKey) $sDecrypted=Vigenere($sCipher,$sKey,1) if $sEncrypted==$sCipher and $sDecrypted==$sPlain $iValid=$iValid+1 else "NON VALID:" ? "Encrypted: " $sEncrypted ? "Decrypted: " $sDecrypted ? "Cipher: " $sCipher ? "Original: " $sPlain ?? sleep 1 endif else $sEncrypted=Vigenere($sPlain,$sKey) $sDecrypted=Vigenere($sEncrypted, $sKey, not 0) if $sDecrypted==$sPlain $iValid=$iValid+1 endif endif endif next
; this is the end of the main loop $sEndTimeDate=@DATE+' '+@TIME+'.'+right('000'+@MSECS,3) $sRunTime=datetimediff($sStartTimeDate, $sEndTimeDate) $iValidPercent=formatnumber(cdbl($iValid)/(1+$iTotal)*100,0)
$sValidCipherOps=''+$iValid+' ('+$iValidPercent+'%)' ; this is the end of main loop
; generate KiXtart Golf Score if $bGolfScore $iKiXGolfScore=KiXGolf($sKiXGolfUDF) else $iKixGolfScore='' endif
; generating official KiXGolf Score $sOutput=$sOutput+@CRLF+'KiXtart' $sOutput=$sOutput+@CRLF+'KiXtart Version = '+@KIX $sOutput=$sOutput+@CRLF+'KiXforms Version = '+$sKiXformsVer $sOutput=$sOutput+@CRLF+'KiXGolf Script = '+@SCRIPTNAME $sOutput=$sOutput+@CRLF+'' $sOutput=$sOutput+@CRLF+'Computer' $sOutput=$sOutput+@CRLF+'OS = '+@PRODUCTTYPE $sOutput=$sOutput+@CRLF+'CPU = '+@CPU $sOutput=$sOutput+@CRLF+'Speed = '+@MHZ+' MHz' $sOutput=$sOutput+@CRLF+'Memory = '+(round(cdbl(MEMORYSIZE(0))/2)*2)+' MB' $sOutput=$sOutput+@CRLF+'' $sOutput=$sOutput+@CRLF+'KiXGolf Scoring Engine' $sOutput=$sOutput+@CRLF+'Scoring Engine = '+$sKiXGolfScrEngVer $sOutput=$sOutput+@CRLF+'' $sOutput=$sOutput+@CRLF+'KiXtart Golf Score' $sOutput=$sOutput+@CRLF+'Tournament = '+$sTitle $sOutput=$sOutput+@CRLF+'Valid Cipher Ops = '+$sValidCipherOps $sOutput=$sOutput+@CRLF+'Processing Start = '+$sStartTimeDate $sOutput=$sOutput+@CRLF+'Processing End = '+$sEndTimeDate $sOutput=$sOutput+@CRLF+'Duration = '+$sRunTime $sOutput=$sOutput+@CRLF+'KiXGolf Score = '+$iKiXGolfScore $sOutput=$sOutput+@CRLF+' ' $sOutput=$sOutput+@CRLF+'Thank you for participating in KiXtart Golf!'
; saving and displaying official KiXtart Golf Score $iRC=redirectoutput($sOutputFile,0) ? $sOutput+@CRLF+'[/code]' $iRC=redirectoutput('') ? $sOutput
if instr(@scriptexe,"WKIX") ?"press any key to close" get $sOutput endif exit 0
_________________________
!download KiXnet
|
Top
|
|
|
|
#123797 - 2004-07-30 12:47 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
k, after talking with pat some more, my code will be disqualified. my table is not as rules say. Quote:
The three groups are ordered as follows: 0-9, Z-A, a-z. Thus, the cipher table would consist of the blocks 0-9, Z-A, a-z ordered as "0123456789ZYX ... CBAabc ... xyz" plus the appropriate shifting.
where I read and coded it as: The three groups are ordered as follows: 0-9, A-Z, a-z. Thus, the cipher table would consist of the blocks 0-9, A-Z, a-z ordered as "0123456789ABC ... XYZabc ... xyz" plus the appropriate shifting.
well, I won't be fixing my code for this thing anymore. too much wasted energy just to see there was a catch 21. I surrender. see you boys on public round.
_________________________
!download KiXnet
|
Top
|
|
|
|
#123798 - 2004-07-30 12:55 AM
Re: KiXgolf: Vigenere Cipher - Private coding
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry to hear that Jooel. I have some code you could use to get around that character order issue, but you will have to wait for the public round.
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 504 anonymous users online.
|
|
|