0 Replies - 1184 Views - Last Post: 11 February 2010 - 03:13 AM Rate Topic: -----

#1 cassiere82   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-February 10

Enigma algorithm strange behavior

Posted 11 February 2010 - 03:13 AM

I am developing a simple Java application ciphering and deciphering messages. I am using the algorithm shown here

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 :)

Is This A Good Question/Topic? 0
  • +

Page 1 of 1