/ for the mi5 test / Instructions for use: / Isolate each font difference as a character and then list them, e.g. / bbaaabbabbbabaababaabaazbaayabbaabbbaaabbbazabbbbybaabbbaabbbbabybbbza / Put that into a file, called say input. / Then type / k mo input / to see the output come to the screen. / If you don't want it on the screen, then type / k mo input > output / and it will go to the output file. / You can then scroll that at your leisure. / / Notes; / 1. It will try a thousand combinations if there are more than / 11 unique characters or it will try all possible combinations. / 2. It assumes the binary encoding given below in lets, i.e. / 00000 gives a, 00001 gives b etc. / given a series of characters, assign 1s or 0s to them / in some systematic way, then translate this into letters / using a 32 position encoding. lets: "abcdefghijklmnopqrstuvwxyz ,0123456789" / translate binary sequence of 1s and 0s assuming that letters / are labeled 00000 for a, 00001 for b etc. as in lets trans:{[seq] rs: |seq x: 0 i: 0 while[i < #rs x+: (rs[i]) * (2 ^ i) i+: 1 ] :lets[_ x] } / generate an encoding randomly findencoding:{[chars] part: = chars uniqs: ?chars e: (#uniqs) _draw 2 out: (#chars) # 0 i: 0 while[i < #part out[part[i]]: e[i] i+: 1 ] outlet: () i: 0 while[i < #out x: (#out) - i if[x < 5 outlet,: trans[i _ out] ] if[~ x < 5 outlet,: trans[out[i+!5]] ] i+: 5 ] :outlet } / given a bit sequence corresponding to the unique characters, / apply that and get a translation. findencodinggen:{[chars;bitseq] part: = chars e: bitseq out: (#chars) # 0 i: 0 while[i < #part out[part[i]]: e[i] i+: 1 ] outlet: () i: 0 while[i < #out x: (#out) - i if[x < 5 outlet,: trans[i _ out] ] if[~ x < 5 outlet,: trans[out[i+!5]] ] i+: 5 ] :outlet } / if there are num characters generate all 2^num bit sequences / from 0 to (2^num) - 1 genbitseq:{[num] bits: 0 1 out: ,:' bits i: 1 while[i < num out: ,/out ,\:/: bits i+: 1 ] :out } reversetrans:{[string] i: 0 out: () while[i < #string x: lets ? string[i] outbits: 0 0 0 0 0 if[~ x < 16 outbits[0]: 1 x-: 16 ] if[~ x < 8 outbits[1]: 1 x-: 8 ] if[~ x < 4 outbits[2]: 1 x-: 4 ] if[~ x < 2 outbits[3]: 1 x-: 2 ] if[~ x < 1 outbits[4]: 1 x-: 1 ] out,: outbits i+: 1 ] jj: & out = 1 kk: & out = 0 outstring: ((#out) ) # "a" outstring[kk]: "b" if[0 < #kk kk2: 3 _draw #kk outstring[kk[kk2]]: "y" ] if[0 < #jj jj2: 3 _draw #jj outstring[jj[jj2]]: "z" ] :outstring } chars: "cxyuvwuvwyxyzywvx" / this is input chars: reversetrans["hello mohammed are you a member of the isi"] "motmp" 0: chars if[0 < #_i file: _i[0] chars: ,/ 0: file ] output: () numuniq: #?chars if[numuniq > 11 do[1000 / number of encoding characters output,: ,findencoding[chars] ] ] if[~ numuniq > 11 bitseqs: genbitseq[numuniq] output: findencodinggen[chars]'bitseqs ] ` 0: output \\