http://www.dreaminco...o=new_post&f=50
Instead on the Main I just call the Enigma object this way
Rotor[] r = { Rotor.ROTOR_I, Rotor.ROTOR_II, Rotor.ROTOR_III };
int r_I = firstPicker.getCurrent();
int r_II = secondPicker.getCurrent();
int r_III = thirdPicker.getCurrent();
int r_IV = fourthPicker.getCurrent();
if (r_IV == 0)
r_IV = -1;
int[] key = { r_I, r_II, r_III, r_IV };
Enigma machine = new Enigma(r,Inverter.STANDARD_INVERTER);
machine.set(key);
try {
code = machine.encrypt(plain_msg.getText().toString());
} catch (Exception e) {}
I am just using three rotors and the inverter. The problem is whatever the key is I always get the same code (except the flip -1 +1). That is, from the same message whatevere the key is i always get the same two codes.
How is it possible?
Thks
Bye
Admin Edit: Please use code tags when posting your code. Code tags are used like so => :code:
Thanks,
PsychoCoder :)

New Topic/Question
Reply



MultiQuote

|