[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

VMs: Reducing the 2nd order entropy by sorting within words



Title: Nachricht
Just for fun I wrote a small awk program and let that work with some Latin text.It just sorts the characters with a word unique and guess what: the output h2 is as low as 2.277 (according to monkey).So, as the resulting words (no substition yet) are ambigious, I must find some way to enter some code, to make the reverse sorting possible.
Seems, that sorting could be part of the encryption scheme.
awk script:
{
     o=sortw($1);
 for(i=2;i<=NF;i++)
  o=o " " sortw($i);
     print o;
}
function sortw(s)
{
        print substr(s,1,1) > "tmpso";
 for(c=2;c<=length(s);c++)
  print  substr(s,c,1) >> "tmpso";
 close("tmpso");
 cmd="sort -u tmpso";
 os=""
 while((cmd|getline x) >0)
 os=os x;
 close(cmd);
 return os;
}
 
Cheers
Claus