Program to decode scytale cypher



Hi!

I wrote a simple java program to decode scytale ciphers (columnar transposition). Here is the code:

private String Decode(int len) {
StringBuffer buf = new StringBuffer();
for(int i = 0; i < len; i++) {
for(int j = 0; j < cipher.length(); j = j + len) {
char ch;
if(i+j < cipher.length()) {
ch = cipher.charAt((i + j));
buf.append(ch);
}
}
}
return buf.toString();
}

Well it works for example for "kerhe lxdit atzfe rwufx ticrt" (klartext
wird zu chiffretext)

Then I found this message:
"IMAZNNDCABMEUUÜHLEARNRNRNRNWEIBNEAIDMSIOSRNAISNCNCEHBEHNHNIAIEHCENNMAHIND-DTN"

But I can't decode it ?? Works the code correctly?

THX!

Tobias
.



Relevant Pages

  • Re: sorting arrays
    ... > private String fromString; ... > Look up the Comparable and Comparator interface. ... has the char of another script, ...
    (comp.lang.java.help)
  • Help
    ... {Scanner scn = new Scanner; ... private String Simplify(String cal,char st,char nd,char new) ... public static void main ...
    (comp.lang.java.help)
  • Re: writeObject IOException
    ... public class Person implements Serializable { ... private String unit; ... private char[] code; ...
    (comp.lang.java.programmer)