I assume this has been done before, but since the Burrows-Wheeler transform seemed like such a cool way to obfuscate text, I decided to write my own japh with it.
my$l='}(yr=etd4d)c305123826312366135714622,,,,,,,,,,,811=1,1,-(,--,,,, +17-,81111-08,6-0-7,-,-,,--)0dc+t(y$$(@@@liswchhri;>!<i{hp=nf;mm))'; $l =~ s/>!</\0/;my@i=split//,$l;my@t=sort@i; for(1..@i-1){my($i,$j)=0;for$j(@t){$j=$i[$i++].$j;}@t=sort@t;} my($a)=@t;$a=~s/\0//;eval$a;
This just takes a string that has been encoded with the BWT, decodes it, and passes it to eval. The string itself is a minimally obfucated perl program to display a string encoded as a list of numbers
Here is the short program I wrote to compute the BWT
my$in="$ARGV[0]\0"; sub n{substr($_[0],1).substr($_[0],0,1)} my($r, @r)=(n($in),$in); while(${r}ne$r[0]){push@r,$r;$r = n($r);} @r=sort@r;my$l=join'',map{substr($_,-1,1)}@r;
The null character is used as an end of line indicator, just so the sorting is easier. In the first program, the null is replaced with ">!<" for storage.
|
|---|