k, I took a traditional approach:




KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_ts.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 797 MHz
Memory = 1014 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Top Secret
Processing Start = 2007/08/09 22:56:23.781
Processing End = 2007/08/09 22:56:24.375
Duration = 0000/00/00 00:00:00.593
KiXGolf Result = Solution passed all 20 tests
KiXGolf Score = 354

Thank you for participating in KiXtart Golf!




code:

; begin Top Secret
;
;!
Function a($l,$b,$c,$d)
/*
1) the block length
2) the permutation
3) the message to be encoded or decoded
4) a parameter denoting encoding (E) or decoding (D)
*/

dim $i,$o[($c^)],$g,$,$r,$k
for $i=0 to ($c^)
$=substr($c,$i+1,1)
$a=asc(ucase($))
if $a>64 & $a<91
$g=$g+1
$k=$k+$
$r=$r+" "+$i
endif
$o[$i]=$
if $g=$l | $i=($c^)
for each $a in split($b,",")
if $i+$a-$g-1<($c^)
$=$+" "+$a
endif
next
$=split($)
for $a=1 to $g
$o[split($r)[iif($d=E,$a,$[$a])]]=substr($k,iif($d=E,$[$a],$a),1)
next
redim $r,$g,$k
$a=join($o,'')
EndFunction
;!
;!
; end Top Secret
_________________________
!

download KiXnet