Page 1 of 9 12345>Last »
Topic Options
#203459 - 2011-11-06 05:35 PM Kixgolf - Whitespace Obfuscation - Private Round
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
=============
The Challenge - Whitespace Obfuscation
=============


Introduced at DEFCON 16 in 2008 by Kolisar, whitespace obfuscation (WO) was used with javascript to hide code in html.
Whitespace characters are ascii characters, that when printed or displayed, appear as blanks. Although there are
others, the most common whitespace characters are spaces " ", and a tabs " ".

The process of WO is to use whitespace characters to encode binary ascii values. When encoding, the first step is to
convert a standard line of text to its binary equivalent, and then substitute the binary 1s and 0s, with tabs and spaces.
The end result is what appears to be nothing but blank space.

Binary ascii characters are represented as 0s and 1s and are 8 digits long. The following chart defines
those values.

 Code:
Num Chr Binary               Num Chr Binary               Num Chr Binary  
----------------------------------------------------------------------------
 9 Tab 00001001

 32    00100000               64 @  01000000               96 `  01100000
 33 !  00100001               65 A  01000001               97 a  01100001
 34 "  00100010               66 B  01000010               98 b  01100010
 35 #  00100011               67 C  01000011               99 c  01100011
 36 $  00100100               68 D  01000100              100 d  01100100
 37 %  00100101               69 E  01000101              101 e  01100101
 38 &  00100110               70 F  01000110              102 f  01100110
 39 '  00100111               71 G  01000111              103 g  01100111
 40 (  00101000               72 H  01001000              104 h  01101000
 41 )  00101001               73 I  01001001              105 i  01101001
 42 *  00101010               74 J  01001010              106 j  01101010
 43 +  00101011               75 K  01001011              107 k  01101011
 44 ,  00101100               76 L  01001100              108 l  01101100
 45 -  00101101               77 M  01001101              109 m  01101101
 46 .  00101110               78 N  01001110              110 n  01101110
 47 /  00101111               79 O  01001111              111 o  01101111
 48 0  00110000               80 P  01010000              112 p  01110000
 49 1  00110001               81 Q  01010001              113 q  01110001
 50 2  00110010               82 R  01010010              114 r  01110010
 51 3  00110011               83 S  01010011              115 s  01110011
 52 4  00110100               84 T  01010100              116 t  01110100
 53 5  00110101               85 U  01010101              117 u  01110101
 54 6  00110110               86 V  01010110              118 v  01110110
 55 7  00110111               87 W  01010111              119 w  01110111
 56 8  00111000               88 X  01011000              120 x  01111000
 57 9  00111001               89 Y  01011001              121 y  01111001
 58 :  00111010               90 Z  01011010              122 z  01111010
 59 ;  00111011               91 [  01011011              123 {  01111011
 60 <  00111100               92 \  01011100              124 |  01111100
 61 =  00111101               93 ]  01011101              125 }  01111101
 62 >  00111110               94 ^  01011110              126 ~  01111110
 63 ?  00111111               95 _  01011111              

Using "Hello World" as an example, first convert the string of ascii characters to binary

Hello World=0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100

or broken down by letter:
H=01001000
e=01100101
l=01101100
l=01101100
o=01101111
space=00100000
W=01010111
o=01101111
r=01110010
l=01101100
d=01100100

Then substituting a space with the 0s, and a tab with the 1s, results in what appears to be a blank data on the right
side of the equals sign below. However, there is data there and it represents Hello World in WO form.


Hello World=






Encoding and Decoding will require a KEY.
During *ENCODING* the KEY defines what value is substitued for the 0's and 1's and is provided as
the second parameter (optional). If the KEY is a space, then 0s are substituted with spaces and 1's are substituted with tabs.
If the KEY is a tab, then 0's are substituted with tabs and 1's are substituted with spaces.

During *DECODING*, the KEY is found as the last character of the WO string. Again it will define
what values are substituted for spaces and tabs. If the KEY is a space, then spaces are substituted with 0's and tabs are
substituted with 1's. If the KEY is a tab, then tabs are substituted with 0's and spaces are substituted with 1's.


*-->A download is available at http://www.kixtart.org/forums/ubbthreads.php?ubb=download&Number=250

=============
Specification
=============


Using WO encode a clear text string or decode the WO string to a clear text string.

When encoding clear text to WO text:
- Convert each character to it's binary equivalant
- Using the KEY, substitute each 0 and 1 with it's defined replacement of either a space or tab
- Append the KEY to the end of the WO string

When decoding WO text to clear text:
- Determine the KEY from the last character of the WO string
- Using the KEY, substitute each space and tab with its defined replacement of either a 0 or 1
- Convert the Binary numbers to the character equivalant

=============
Inputs and Outputs
=============


The input consists of either a clear text string or a WO encoded string.

When encoding there will also be a second parameter called the KEY. The KEY value will either be a space or tab. The KEY
defines what to substitue the 0 value with. The 1 value will be substituted with the other of the two characters (either
space or tab). For example, if $key=" " (space), 0's are substituted with spaces, and 1's are substituted with tabs. And
if $key=" " (tab), 0's are substituted with tabs, and 1's are substituted with spaces.

=================================================================
Notes
================================================================

- The scoring engine has added code to help diagnose which cases are failing. To see test case results:
 Code:
   kix32 kixgolf_wo $verbose=1 ;shows failing results
   kix32 kixgolf_wo $verbose=2 ;shows all results

- The scoring engine expects your (primary) function to be named a().


=======
Scoring
=======


The solution must pass all tests in order for it's KiXgolf Score to be considered.

When posting KiXtart Golf Scores, please include the KIXGOLF_*.TXT file that is created in the script directory. It contains some basic information about the computer that the script is run on and the resulting scores.

============
Test program
============


Test cases are provided to help screen entries and to provide the Golf Score.
Any script that passes the test cases can be submitted. If you are surprised that your solution passed the test cases, please submit it anyway! That will help me identify bugs in the test program.

================================================================
KiXtart GOLF - How To Play
================================================================


Most importantly, anybody can play, no age restrictions, no penalties, no handicap!

The object in "real" golf is to hit the ball in the hole in the fewest strokes. The object in KiXtart Golf is to get from input (tee) to target (hole) in the fewest keystrokes.

Example: How many positive elements are in array $a?

Array $a could be of structure $a=[1, 2 ,-3, 4, -5, -7, 8, 9]

One approach:
 Code:
for $b=0 to ubound($a)
  if $a[$b]>0
    $c=$c+1
  endif
next

for a score of 45.

Another solution is:
 Code:
DO
  $b=$b+1
  if $a[$b]>0
    $c=$c+1
  endif
UNTIL $b>(UBOUND($a)+1)

for a score of 53.

Better approach: Code sample 1

================================================================
KiXtart GOLF - The Rules
================================================================


1) The goal of KiXtart Golf is to score the lowest strokes.
2) Strokes are all characters in a piece of code except whitespace characters, unless the whitespace character is necessary for the line of code to work. Therefore, carriage returns and line feeds do not count or spaces in between the '=' sign when assigning variables, e.g. '$a = $b' scores 5.
3) Code can be constructed any way you like, as long as it does not generate syntax or other errors when running the script in KiXtart.
4) The final solution MUST pass all test scripts that are part of the KiXtart golf challenge.
7) During the private coding phase, no code is allowed to be posted. Violations result in disqualification of said player.
8) During the public coding phase, code should be posted, reused, and borrowed from other players.
9) The test script contains the official KiXgolf scoring engine
10) Only the person posting a particular score will be recognized for the score, unless the KiXtart Golf Challenge organizer or another delegate posts code on behalf of a player
11) KiXtart Golf (a.k.a KiXgolf) codes must be written inside the KiXgolf UDF collection tags, ';!' and ';!;!'
12) Parameter names of the UDF's can be changed and additional optional parameters can be added.
13) Additional helper UDFs and code can be written as long as they reside inside the ';!' and ';!;!' tags.
14) The use of '$' as a variable is allowed.
15) The UDF layout is up to coder.
16) The UDF is expected to finish in a reasonable time, that is, on modern computers inside 1 hour timeframe.
17) You can submit scores as often as you want.
18) If you reach leading score, you are obligated to post your score immediately so others can try to compete with you.
19) The UDF may only use the KiXtart/KiXforms commands/functions/macros, no other code fragments are allowed.
20) Calls to COM components that are part of a standard default Windows installation are allowed.
21) The use of the KiXforms DLL is also permitted as the KiXforms DLL can now be considered an integral part of KiXtart scripting.
22) Calls to other executables, as long as they are part of a standard default Windows installation are allowed.
23) The UDF should be self-contained (except for any I/O mentioned in the challenge). In particular, you may not do things like fetching extra data from a remote site or file.
24) You may assume ASCII as character set.
25) You may use block comments as the KiXgolf Scoring Engine now supports block comments.
26) You are allowed to only use publicly available versions of KiXtart and KiXforms, private builds or alpha builds are NOT allowed.
27) Your submitted score must include the result print of the KiXgolf test-engine.
28) The SETOPTION() parameters in the KiXgolf script may not be modified and will govern the script behavior. SETOPTION() parameters may change depending on the particular needs of the KiXgolf challenge.
29) Tokenizing the UDF, script, or portions thereof is not allowed.
30) If something is not explicitly denied by the rules, it's allowed.
31) If Confusion arises, arranger of the KiXgolf round has the final say.
32) Additional test cases can be added at any time during the KiXgolf round. The code is expected to pass based on the rules. The test cases may not include tests for all rules and exceptions. Test cases that are added during the public round will not alter the results of the private round.


================================================================
KiXtart GOLF - The Duration of the Competition
================================================================


1) Private coding phase: 2011-11-06 to 2011-11-13 (Official Count down clock will determine end time)

2) Public coding phase: 2011-11-13 to 2011-11-20

3) Final results: 2011-11-21


*--> You will need the complete package from http://www.kixtart.org/forums/ubbthreads.php?ubb=download&Number=250.


Attachments
kixgolf_wo.zip (458 downloads)
Description:



Top
#203460 - 2011-11-06 05:38 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA

Top
#203461 - 2011-11-06 05:43 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
While you are testing your code there is also a VerboseInput and VerboseOutput in the ini. The expected spaces and tabs are replaced with S for Space and T for Tab.
Top
#203462 - 2011-11-06 06:44 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
November 6th already? Wow, tempus fugit
Ok, will start with it tomorrow, today I will have to be with teh family \:\)
_________________________



Top
#203463 - 2011-11-06 09:48 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if optional key is not specified, what then?
we can guess the key?
or will it always be there when encoding?
_________________________
!

download KiXnet

Top
#203464 - 2011-11-06 10:17 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh... so we are not supposed to do the binary encode/decode?
_________________________
!

download KiXnet

Top
#203465 - 2011-11-06 10:19 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nevermind...
_________________________
!

download KiXnet

Top
#203466 - 2011-11-06 10:22 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
anyways, wtf Im supposed to do with the verbose thingie in the ini?
Is there a way to invoke that kinda "processing" in the scoring engine?
_________________________
!

download KiXnet

Top
#203467 - 2011-11-06 10:22 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
halfway to a working solution
_________________________
Eric

Top
#203468 - 2011-11-06 10:34 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: maciep]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
 Quote:
Is there a way to invoke that kinda "processing" in the scoring engine?


Sorry, I had it in there but removed it because there was just to much "Crap" on the screen.

It was something like
 Code:
    case $sInputResult=$sOutput
      $iPass=$iPass+1
      if $verbose=2
        color "g+"
        ? $sSection
        ? "Input: " + $sInput
        if $sVinput<>""
          ? "VerboseInput:" + $sVinput
        endif
        ? " INIResult: " + $sOutput
        if $sVOutput<>""
          ? "VerboseInput:" + $sVOutput
        endif
        ? "YourResult: " + $sInputResult
        ?
        color $ocolor
      endif


Edited by Allen (2011-11-06 10:40 PM)

Top
#203469 - 2011-11-06 10:53 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Allen]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
ok, lazy and ugly code is working..

 Code:
KiXtart Version  = 4.62
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Home Premium Edition
CPU              = AMD Turion(tm) II P540 Dual-Core Processor
Speed            = 2394 MHz
Memory           = 4096 MB

Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/06 16:51:26.960
Processing End   = 2011/11/06 16:51:27.460
Duration         = 0000/00/00 00:00:00.500
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 696
_________________________
Eric

Top
#203470 - 2011-11-06 11:09 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: maciep]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
dang, wasn't the first one... got some family stuff as well for an excuse.

anyways, my lazy starter:
 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 1396 MHz
Memory           = 4096 MB

Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/07 00:07:40.570
Processing End   = 2011/11/07 00:07:40.746
Duration         = 0000/00/00 00:00:00.175
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 376

Thank you for participating in KiXtart Golf!
_________________________
!

download KiXnet

Top
#203471 - 2011-11-06 11:16 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm... guess this second type of code is the king :p
 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 1396 MHz
Memory           = 4096 MB

Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/07 00:15:01.718
Processing End   = 2011/11/07 00:15:01.972
Duration         = 0000/00/00 00:00:00.254
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 314

Thank you for participating in KiXtart Golf!
_________________________
!

download KiXnet

Top
#203472 - 2011-11-06 11:23 PM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
I need to start from scratch...can't get a good score being so lazy \:\)
_________________________
Eric

Top
#203473 - 2011-11-07 12:04 AM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: maciep]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
kinda sad, cause it looks ugly, but it works...

 Code:
KiXGolf Score    = 298
_________________________
!

download KiXnet

Top
#203474 - 2011-11-07 12:17 AM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
ok, now I can start golfing...

 Code:
KiXtart Version  = 4.62
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Home Premium Edition
CPU              = AMD Turion(tm) II P540 Dual-Core Processor
Speed            = 2394 MHz
Memory           = 4096 MB

Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/06 18:15:47.915
Processing End   = 2011/11/06 18:15:48.429
Duration         = 0000/00/00 00:00:00.514
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 403
_________________________
Eric

Top
#203475 - 2011-11-07 12:17 AM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: maciep]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yehaa, let the games begin! \:\)

 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 1396 MHz
Memory           = 4096 MB

Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/07 01:16:51.803
Processing End   = 2011/11/07 01:16:52.095
Duration         = 0000/00/00 00:00:00.292
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 290
_________________________
!

download KiXnet

Top
#203476 - 2011-11-07 12:25 AM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_wo.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 1396 MHz
Memory           = 4096 MB

Tournament       = Whitespace Obfuscation
Processing Start = 2011/11/07 01:25:05.643
Processing End   = 2011/11/07 01:25:05.899
Duration         = 0000/00/00 00:00:00.256
# Tests Run      = 40
# Tests Passed   = 40
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 271
_________________________
!

download KiXnet

Top
#203477 - 2011-11-07 12:29 AM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it is so ugly :'(
_________________________
!

download KiXnet

Top
#203478 - 2011-11-07 12:31 AM Re: Kixgolf - Whitespace Obfuscation - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
KiXGolf Score = 268
_________________________
!

download KiXnet

Top
Page 1 of 9 12345>Last »


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

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.077 seconds in which 0.028 seconds were spent on a total of 15 queries. Zlib compression enabled.

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