mirror of
https://github.com/vanitasvitae/EnigmAndroid.git
synced 2024-11-22 04:12:06 +01:00
Added Enigma K, KSwiss, KSwissAirforce, R, G31, G260, G312, changed identifiers of models, changed landscape layout d, updated about-dialog
This commit is contained in:
parent
802b51f91d
commit
63682d6462
29 changed files with 2016 additions and 155 deletions
|
@ -1,16 +1,24 @@
|
||||||
CHANGELOG ENIGMANDROID
|
CHANGELOG ENIGMANDROID
|
||||||
v0.1.7-15.09.2015<
|
v0.1.8-not-yet-released<
|
||||||
*Added Enigma K
|
*Added Enigma G31
|
||||||
*Added Enigma T
|
*Added Enigma G312
|
||||||
*Created Plugboard-/pluggable Reflector-Setting-Dialog
|
*Added Enigma G260
|
||||||
|
*Replaced Enigma K with Enigma K, K (Swiss) and K (Swiss, Airforce)
|
||||||
|
*Added Enigma R
|
||||||
|
*Changed identifiers of enigma models
|
||||||
|
*Changed landscape layout of enigma model d
|
||||||
|
*Updated the about-dialog text.
|
||||||
*TODO: Add Enigma Z (Probably wont happen due to lack of information :/)
|
*TODO: Add Enigma Z (Probably wont happen due to lack of information :/)
|
||||||
*TODO: Add Enigma G
|
|
||||||
*TODO: Add Enigma R
|
|
||||||
*TODO: Rework Rotor-/Reflector creation
|
*TODO: Rework Rotor-/Reflector creation
|
||||||
*TODO: Add multi-Enigma (select any rotor/reflector etc. Probably wont happen too soon)
|
*TODO: Add multi-Enigma (select any rotor/reflector etc. Probably wont happen too soon)
|
||||||
*TODO: Rework InputPreparer using decorator pattern to allow user customization
|
*TODO: Rework InputPreparer using decorator pattern to allow user customization
|
||||||
*
|
*
|
||||||
|
|
||||||
|
v0.1.7-15.09.2015<
|
||||||
|
*Added Enigma K
|
||||||
|
*Added Enigma T
|
||||||
|
*Created Plugboard-/pluggable Reflector-Setting-Dialog
|
||||||
|
|
||||||
v0.1.6-10.09.2015<
|
v0.1.6-10.09.2015<
|
||||||
*Fixed about dialog (outdated manual)
|
*Fixed about dialog (outdated manual)
|
||||||
*Updated CHANGELOG (oops)
|
*Updated CHANGELOG (oops)
|
||||||
|
|
|
@ -163,10 +163,14 @@ public class MainActivity extends Activity
|
||||||
this.setContentView(R.layout.activity_main_d);
|
this.setContentView(R.layout.activity_main_d);
|
||||||
break;
|
break;
|
||||||
case "K":
|
case "K":
|
||||||
this.setContentView(R.layout.activity_main_k_t);
|
case "KS":
|
||||||
break;
|
case "KSA":
|
||||||
case "T":
|
case "T":
|
||||||
this.setContentView(R.layout.activity_main_k_t);
|
case "R":
|
||||||
|
case "G31":
|
||||||
|
case "G312":
|
||||||
|
case "G260":
|
||||||
|
this.setContentView(R.layout.activity_main_g_k_t);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.setContentView(R.layout.activity_main_i_m3);
|
this.setContentView(R.layout.activity_main_i_m3);
|
||||||
|
@ -217,7 +221,7 @@ public class MainActivity extends Activity
|
||||||
if(prefAnomaly !=anomaly)
|
if(prefAnomaly !=anomaly)
|
||||||
{
|
{
|
||||||
prefAnomaly = anomaly;
|
prefAnomaly = anomaly;
|
||||||
if(layoutContainer != null) layoutContainer.getEnigma().setPrefAnomaly(anomaly);
|
if(layoutContainer != null && layoutContainer.getEnigma() != null) layoutContainer.getEnigma().setPrefAnomaly(anomaly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class Enigma_D extends Enigma {
|
||||||
protected Rotor rotor2;
|
protected Rotor rotor2;
|
||||||
protected Rotor rotor3;
|
protected Rotor rotor3;
|
||||||
|
|
||||||
protected Reflector.ReflectorEnigmaDKD reflector;
|
protected Reflector.ReflectorEnigma_D_KD_G31 reflector;
|
||||||
|
|
||||||
public Enigma_D()
|
public Enigma_D()
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public class Enigma_D extends Enigma {
|
||||||
this.rotor1 = Rotor.createRotor(11, 0, 0);
|
this.rotor1 = Rotor.createRotor(11, 0, 0);
|
||||||
this.rotor2 = Rotor.createRotor(12, 0, 0);
|
this.rotor2 = Rotor.createRotor(12, 0, 0);
|
||||||
this.rotor3 = Rotor.createRotor(13, 0, 0);
|
this.rotor3 = Rotor.createRotor(13, 0, 0);
|
||||||
this.reflector = new Reflector.ReflectorEnigmaDKD();
|
this.reflector = new Reflector.ReflectorEnigma_D_KD_G31();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,7 +96,7 @@ public class Enigma_D extends Enigma {
|
||||||
this.rotor1 = Rotor.createRotor(state.getTypeRotor1(), state.getRotationRotor1(), state.getRingSettingRotor1());
|
this.rotor1 = Rotor.createRotor(state.getTypeRotor1(), state.getRotationRotor1(), state.getRingSettingRotor1());
|
||||||
this.rotor2 = Rotor.createRotor(state.getTypeRotor2(), state.getRotationRotor2(), state.getRingSettingRotor2());
|
this.rotor2 = Rotor.createRotor(state.getTypeRotor2(), state.getRotationRotor2(), state.getRingSettingRotor2());
|
||||||
this.rotor3 = Rotor.createRotor(state.getTypeRotor3(), state.getRotationRotor3(), state.getRingSettingRotor3());
|
this.rotor3 = Rotor.createRotor(state.getTypeRotor3(), state.getRotationRotor3(), state.getRingSettingRotor3());
|
||||||
this.reflector = new Reflector.ReflectorEnigmaDKD();
|
this.reflector = new Reflector.ReflectorEnigma_D_KD_G31();
|
||||||
this.reflector.setConfiguration(state.getConfigurationReflector());
|
this.reflector.setConfiguration(state.getConfigurationReflector());
|
||||||
this.reflector.setRotation(state.getRotationReflector());
|
this.reflector.setRotation(state.getRotationReflector());
|
||||||
this.reflector.setRingSetting(state.getRingSettingReflector());
|
this.reflector.setRingSetting(state.getRingSettingReflector());
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.enigma;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Enigma machine of type G31 (Abwehr)
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class Enigma_G260 extends Enigma_G31
|
||||||
|
{
|
||||||
|
public Enigma_G260()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
machineType = "G260";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void initialize()
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(29, 0, 0);
|
||||||
|
this.rotor2 = Rotor.createRotor(30, 0, 0);
|
||||||
|
this.rotor3 = Rotor.createRotor(31, 0, 0);
|
||||||
|
this.reflector = Reflector.createReflector(10);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.enigma;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Enigma machine of type G31 (Abwehr)
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class Enigma_G31 extends Enigma
|
||||||
|
{
|
||||||
|
protected Rotor entryWheel;
|
||||||
|
protected Rotor rotor1;
|
||||||
|
protected Rotor rotor2;
|
||||||
|
protected Rotor rotor3;
|
||||||
|
|
||||||
|
protected Reflector reflector;
|
||||||
|
|
||||||
|
public Enigma_G31()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
machineType = "G31";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void initialize()
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(32, 0, 0);
|
||||||
|
this.rotor2 = Rotor.createRotor(33, 0, 0);
|
||||||
|
this.rotor3 = Rotor.createRotor(34, 0, 0);
|
||||||
|
this.reflector = Reflector.createReflector(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nextState()
|
||||||
|
{
|
||||||
|
rotor1.rotate();
|
||||||
|
if (rotor1.isAtTurnoverPosition() || (this.doAnomaly && prefAnomaly))
|
||||||
|
{
|
||||||
|
rotor2.rotate();
|
||||||
|
this.doAnomaly = rotor2.doubleTurnAnomaly();
|
||||||
|
if (rotor2.isAtTurnoverPosition())
|
||||||
|
{
|
||||||
|
rotor3.rotate();
|
||||||
|
if(rotor3.isAtTurnoverPosition())
|
||||||
|
{
|
||||||
|
reflector.setRotation(reflector.getRotation()+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char encryptChar(char k) {
|
||||||
|
nextState();
|
||||||
|
int x = ((int) k)-65; //Cast to int and remove Unicode Offset (A=65 in Unicode.)
|
||||||
|
//Encryption
|
||||||
|
//forward direction
|
||||||
|
x = entryWheel.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting());
|
||||||
|
x = rotor1.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting() + rotor2.getRotation() - rotor2.getRingSetting());
|
||||||
|
x = rotor2.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor2.getRotation() + rotor2.getRingSetting() + rotor3.getRotation() - rotor3.getRingSetting());
|
||||||
|
x = rotor3.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor3.getRotation() + rotor3.getRingSetting() + reflector.getRotation() - reflector.getRingSetting());
|
||||||
|
//backward direction
|
||||||
|
x = reflector.encrypt(x);
|
||||||
|
x = rotor1.normalize(x + rotor3.getRotation() - rotor3.getRingSetting() - reflector.getRotation() + reflector.getRingSetting());
|
||||||
|
x = rotor3.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor2.getRotation() - rotor2.getRingSetting() - rotor3.getRotation() + rotor3.getRingSetting());
|
||||||
|
x = rotor2.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting() - rotor2.getRotation() + rotor2.getRingSetting());
|
||||||
|
x = rotor1.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting());
|
||||||
|
x = entryWheel.encryptBackward(x);
|
||||||
|
return (char) (x + 65); //Add Offset again, cast back to char and return
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(state.getTypeEntryWheel(), 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(state.getTypeRotor1(), state.getRotationRotor1(), state.getRingSettingRotor1());
|
||||||
|
this.rotor2 = Rotor.createRotor(state.getTypeRotor2(), state.getRotationRotor2(), state.getRingSettingRotor2());
|
||||||
|
this.rotor3 = Rotor.createRotor(state.getTypeRotor3(), state.getRotationRotor3(), state.getRingSettingRotor3());
|
||||||
|
this.reflector = Reflector.createReflector(state.getTypeReflector());
|
||||||
|
this.reflector.setRotation(state.getRotationReflector());
|
||||||
|
this.reflector.setRingSetting(state.getRingSettingReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnigmaStateBundle getState() {
|
||||||
|
EnigmaStateBundle state = new EnigmaStateBundle();
|
||||||
|
|
||||||
|
state.setTypeRotor1(rotor1.getNumber());
|
||||||
|
state.setTypeRotor2(rotor2.getNumber());
|
||||||
|
state.setTypeRotor3(rotor3.getNumber());
|
||||||
|
|
||||||
|
state.setRotationRotor1(rotor1.getRotation());
|
||||||
|
state.setRotationRotor2(rotor2.getRotation());
|
||||||
|
state.setRotationRotor3(rotor3.getRotation());
|
||||||
|
|
||||||
|
state.setRingSettingRotor1(rotor1.getRingSetting());
|
||||||
|
state.setRingSettingRotor2(rotor2.getRingSetting());
|
||||||
|
state.setRingSettingRotor3(rotor3.getRingSetting());
|
||||||
|
|
||||||
|
state.setTypeReflector(reflector.getNumber());
|
||||||
|
state.setRotationReflector(reflector.getRotation());
|
||||||
|
state.setRingSettingReflector(reflector.getRingSetting());
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.enigma;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Enigma machine of type G31 (Abwehr)
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class Enigma_G312 extends Enigma_G31
|
||||||
|
{
|
||||||
|
public Enigma_G312()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
machineType = "G312";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void initialize()
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(26, 0, 0);
|
||||||
|
this.rotor2 = Rotor.createRotor(27, 0, 0);
|
||||||
|
this.rotor3 = Rotor.createRotor(28, 0, 0);
|
||||||
|
this.reflector = Reflector.createReflector(9);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the Enigma machine of type K (Switzerland)
|
* Implementation of the Enigma machine of type K
|
||||||
* Copyright (C) 2015 Paul Schaub
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -40,9 +40,9 @@ public class Enigma_K extends Enigma
|
||||||
public void initialize()
|
public void initialize()
|
||||||
{
|
{
|
||||||
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
this.rotor1 = Rotor.createRotor(14, 0, 0);
|
this.rotor1 = Rotor.createRotor(35, 0, 0);
|
||||||
this.rotor2 = Rotor.createRotor(15, 0, 0);
|
this.rotor2 = Rotor.createRotor(36, 0, 0);
|
||||||
this.rotor3 = Rotor.createRotor(16, 0, 0);
|
this.rotor3 = Rotor.createRotor(37, 0, 0);
|
||||||
this.reflector = Reflector.createReflector(7);
|
this.reflector = Reflector.createReflector(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.enigma;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Enigma machine of type K (Switzerland, Airforce)
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class Enigma_K_Swiss_Airforce extends Enigma_K
|
||||||
|
{
|
||||||
|
protected Rotor entryWheel;
|
||||||
|
protected Rotor rotor1;
|
||||||
|
protected Rotor rotor2;
|
||||||
|
protected Rotor rotor3;
|
||||||
|
|
||||||
|
protected Reflector reflector;
|
||||||
|
|
||||||
|
public Enigma_K_Swiss_Airforce()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
machineType = "KSA";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void initialize()
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(38, 0, 0);
|
||||||
|
this.rotor2 = Rotor.createRotor(39, 0, 0);
|
||||||
|
this.rotor3 = Rotor.createRotor(40, 0, 0);
|
||||||
|
this.reflector = Reflector.createReflector(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nextState()
|
||||||
|
{
|
||||||
|
rotor1.rotate();
|
||||||
|
if (rotor1.isAtTurnoverPosition() || (this.doAnomaly && prefAnomaly))
|
||||||
|
{
|
||||||
|
rotor2.rotate();
|
||||||
|
this.doAnomaly = rotor2.doubleTurnAnomaly();
|
||||||
|
if (rotor2.isAtTurnoverPosition())
|
||||||
|
{
|
||||||
|
rotor3.rotate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char encryptChar(char k) {
|
||||||
|
nextState();
|
||||||
|
int x = ((int) k)-65; //Cast to int and remove Unicode Offset (A=65 in Unicode.)
|
||||||
|
//Encryption
|
||||||
|
//forward direction
|
||||||
|
x = entryWheel.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting());
|
||||||
|
x = rotor1.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting() + rotor2.getRotation() - rotor2.getRingSetting());
|
||||||
|
x = rotor2.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor2.getRotation() + rotor2.getRingSetting() + rotor3.getRotation() - rotor3.getRingSetting());
|
||||||
|
x = rotor3.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor3.getRotation() + rotor3.getRingSetting() + reflector.getRotation() - reflector.getRingSetting());
|
||||||
|
//backward direction
|
||||||
|
x = reflector.encrypt(x);
|
||||||
|
x = rotor1.normalize(x + rotor3.getRotation() - rotor3.getRingSetting() - reflector.getRotation() + reflector.getRingSetting());
|
||||||
|
x = rotor3.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor2.getRotation() - rotor2.getRingSetting() - rotor3.getRotation() + rotor3.getRingSetting());
|
||||||
|
x = rotor2.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting() - rotor2.getRotation() + rotor2.getRingSetting());
|
||||||
|
x = rotor1.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting());
|
||||||
|
x = entryWheel.encryptBackward(x);
|
||||||
|
return (char) (x + 65); //Add Offset again, cast back to char and return
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(state.getTypeEntryWheel(), 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(state.getTypeRotor1(), state.getRotationRotor1(), state.getRingSettingRotor1());
|
||||||
|
this.rotor2 = Rotor.createRotor(state.getTypeRotor2(), state.getRotationRotor2(), state.getRingSettingRotor2());
|
||||||
|
this.rotor3 = Rotor.createRotor(state.getTypeRotor3(), state.getRotationRotor3(), state.getRingSettingRotor3());
|
||||||
|
this.reflector = Reflector.createReflector(state.getTypeReflector());
|
||||||
|
this.reflector.setRotation(state.getRotationReflector());
|
||||||
|
this.reflector.setRingSetting(state.getRingSettingReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnigmaStateBundle getState() {
|
||||||
|
EnigmaStateBundle state = new EnigmaStateBundle();
|
||||||
|
|
||||||
|
state.setTypeRotor1(rotor1.getNumber());
|
||||||
|
state.setTypeRotor2(rotor2.getNumber());
|
||||||
|
state.setTypeRotor3(rotor3.getNumber());
|
||||||
|
|
||||||
|
state.setRotationRotor1(rotor1.getRotation());
|
||||||
|
state.setRotationRotor2(rotor2.getRotation());
|
||||||
|
state.setRotationRotor3(rotor3.getRotation());
|
||||||
|
|
||||||
|
state.setRingSettingRotor1(rotor1.getRingSetting());
|
||||||
|
state.setRingSettingRotor2(rotor2.getRingSetting());
|
||||||
|
state.setRingSettingRotor3(rotor3.getRingSetting());
|
||||||
|
|
||||||
|
state.setTypeReflector(reflector.getNumber());
|
||||||
|
state.setRotationReflector(reflector.getRotation());
|
||||||
|
state.setRingSettingReflector(reflector.getRingSetting());
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.enigma;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Enigma machine of type K (Switzerland)
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class Enigma_K_Swiss_Standard extends Enigma_K
|
||||||
|
{
|
||||||
|
protected Rotor entryWheel;
|
||||||
|
protected Rotor rotor1;
|
||||||
|
protected Rotor rotor2;
|
||||||
|
protected Rotor rotor3;
|
||||||
|
|
||||||
|
protected Reflector reflector;
|
||||||
|
|
||||||
|
public Enigma_K_Swiss_Standard()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
machineType = "KS";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void initialize()
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(14, 0, 0);
|
||||||
|
this.rotor2 = Rotor.createRotor(15, 0, 0);
|
||||||
|
this.rotor3 = Rotor.createRotor(16, 0, 0);
|
||||||
|
this.reflector = Reflector.createReflector(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nextState()
|
||||||
|
{
|
||||||
|
rotor1.rotate();
|
||||||
|
if (rotor1.isAtTurnoverPosition() || (this.doAnomaly && prefAnomaly))
|
||||||
|
{
|
||||||
|
rotor2.rotate();
|
||||||
|
this.doAnomaly = rotor2.doubleTurnAnomaly();
|
||||||
|
if (rotor2.isAtTurnoverPosition())
|
||||||
|
{
|
||||||
|
rotor3.rotate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char encryptChar(char k) {
|
||||||
|
nextState();
|
||||||
|
int x = ((int) k)-65; //Cast to int and remove Unicode Offset (A=65 in Unicode.)
|
||||||
|
//Encryption
|
||||||
|
//forward direction
|
||||||
|
x = entryWheel.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting());
|
||||||
|
x = rotor1.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting() + rotor2.getRotation() - rotor2.getRingSetting());
|
||||||
|
x = rotor2.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor2.getRotation() + rotor2.getRingSetting() + rotor3.getRotation() - rotor3.getRingSetting());
|
||||||
|
x = rotor3.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor3.getRotation() + rotor3.getRingSetting() + reflector.getRotation() - reflector.getRingSetting());
|
||||||
|
//backward direction
|
||||||
|
x = reflector.encrypt(x);
|
||||||
|
x = rotor1.normalize(x + rotor3.getRotation() - rotor3.getRingSetting() - reflector.getRotation() + reflector.getRingSetting());
|
||||||
|
x = rotor3.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor2.getRotation() - rotor2.getRingSetting() - rotor3.getRotation() + rotor3.getRingSetting());
|
||||||
|
x = rotor2.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting() - rotor2.getRotation() + rotor2.getRingSetting());
|
||||||
|
x = rotor1.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting());
|
||||||
|
x = entryWheel.encryptBackward(x);
|
||||||
|
return (char) (x + 65); //Add Offset again, cast back to char and return
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(state.getTypeEntryWheel(), 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(state.getTypeRotor1(), state.getRotationRotor1(), state.getRingSettingRotor1());
|
||||||
|
this.rotor2 = Rotor.createRotor(state.getTypeRotor2(), state.getRotationRotor2(), state.getRingSettingRotor2());
|
||||||
|
this.rotor3 = Rotor.createRotor(state.getTypeRotor3(), state.getRotationRotor3(), state.getRingSettingRotor3());
|
||||||
|
this.reflector = Reflector.createReflector(state.getTypeReflector());
|
||||||
|
this.reflector.setRotation(state.getRotationReflector());
|
||||||
|
this.reflector.setRingSetting(state.getRingSettingReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnigmaStateBundle getState() {
|
||||||
|
EnigmaStateBundle state = new EnigmaStateBundle();
|
||||||
|
|
||||||
|
state.setTypeRotor1(rotor1.getNumber());
|
||||||
|
state.setTypeRotor2(rotor2.getNumber());
|
||||||
|
state.setTypeRotor3(rotor3.getNumber());
|
||||||
|
|
||||||
|
state.setRotationRotor1(rotor1.getRotation());
|
||||||
|
state.setRotationRotor2(rotor2.getRotation());
|
||||||
|
state.setRotationRotor3(rotor3.getRotation());
|
||||||
|
|
||||||
|
state.setRingSettingRotor1(rotor1.getRingSetting());
|
||||||
|
state.setRingSettingRotor2(rotor2.getRingSetting());
|
||||||
|
state.setRingSettingRotor3(rotor3.getRingSetting());
|
||||||
|
|
||||||
|
state.setTypeReflector(reflector.getNumber());
|
||||||
|
state.setRotationReflector(reflector.getRotation());
|
||||||
|
state.setRingSettingReflector(reflector.getRingSetting());
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.enigma;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.rotors.Rotor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the Enigma machine of type R ("Rocket", Reichsbahn)
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class Enigma_R extends Enigma
|
||||||
|
{
|
||||||
|
protected Rotor entryWheel;
|
||||||
|
protected Rotor rotor1;
|
||||||
|
protected Rotor rotor2;
|
||||||
|
protected Rotor rotor3;
|
||||||
|
|
||||||
|
protected Reflector reflector;
|
||||||
|
|
||||||
|
public Enigma_R()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
machineType = "R";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void initialize()
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(0, 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(41, 0, 0);
|
||||||
|
this.rotor2 = Rotor.createRotor(42, 0, 0);
|
||||||
|
this.rotor3 = Rotor.createRotor(43, 0, 0);
|
||||||
|
this.reflector = Reflector.createReflector(11);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nextState()
|
||||||
|
{
|
||||||
|
rotor1.rotate();
|
||||||
|
if (rotor1.isAtTurnoverPosition() || (this.doAnomaly && prefAnomaly))
|
||||||
|
{
|
||||||
|
rotor2.rotate();
|
||||||
|
this.doAnomaly = rotor2.doubleTurnAnomaly();
|
||||||
|
if (rotor2.isAtTurnoverPosition())
|
||||||
|
{
|
||||||
|
rotor3.rotate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char encryptChar(char k) {
|
||||||
|
nextState();
|
||||||
|
int x = ((int) k)-65; //Cast to int and remove Unicode Offset (A=65 in Unicode.)
|
||||||
|
//Encryption
|
||||||
|
//forward direction
|
||||||
|
x = entryWheel.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting());
|
||||||
|
x = rotor1.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting() + rotor2.getRotation() - rotor2.getRingSetting());
|
||||||
|
x = rotor2.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor2.getRotation() + rotor2.getRingSetting() + rotor3.getRotation() - rotor3.getRingSetting());
|
||||||
|
x = rotor3.encryptForward(x);
|
||||||
|
x = rotor1.normalize(x - rotor3.getRotation() + rotor3.getRingSetting() + reflector.getRotation() - reflector.getRingSetting());
|
||||||
|
//backward direction
|
||||||
|
x = reflector.encrypt(x);
|
||||||
|
x = rotor1.normalize(x + rotor3.getRotation() - rotor3.getRingSetting() - reflector.getRotation() + reflector.getRingSetting());
|
||||||
|
x = rotor3.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor2.getRotation() - rotor2.getRingSetting() - rotor3.getRotation() + rotor3.getRingSetting());
|
||||||
|
x = rotor2.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x + rotor1.getRotation() - rotor1.getRingSetting() - rotor2.getRotation() + rotor2.getRingSetting());
|
||||||
|
x = rotor1.encryptBackward(x);
|
||||||
|
x = rotor1.normalize(x - rotor1.getRotation() + rotor1.getRingSetting());
|
||||||
|
x = entryWheel.encryptBackward(x);
|
||||||
|
return (char) (x + 65); //Add Offset again, cast back to char and return
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.entryWheel = Rotor.createRotor(state.getTypeEntryWheel(), 0, 0);
|
||||||
|
this.rotor1 = Rotor.createRotor(state.getTypeRotor1(), state.getRotationRotor1(), state.getRingSettingRotor1());
|
||||||
|
this.rotor2 = Rotor.createRotor(state.getTypeRotor2(), state.getRotationRotor2(), state.getRingSettingRotor2());
|
||||||
|
this.rotor3 = Rotor.createRotor(state.getTypeRotor3(), state.getRotationRotor3(), state.getRingSettingRotor3());
|
||||||
|
this.reflector = Reflector.createReflector(state.getTypeReflector());
|
||||||
|
this.reflector.setRotation(state.getRotationReflector());
|
||||||
|
this.reflector.setRingSetting(state.getRingSettingReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnigmaStateBundle getState() {
|
||||||
|
EnigmaStateBundle state = new EnigmaStateBundle();
|
||||||
|
|
||||||
|
state.setTypeRotor1(rotor1.getNumber());
|
||||||
|
state.setTypeRotor2(rotor2.getNumber());
|
||||||
|
state.setTypeRotor3(rotor3.getNumber());
|
||||||
|
|
||||||
|
state.setRotationRotor1(rotor1.getRotation());
|
||||||
|
state.setRotationRotor2(rotor2.getRotation());
|
||||||
|
state.setRotationRotor3(rotor3.getRotation());
|
||||||
|
|
||||||
|
state.setRingSettingRotor1(rotor1.getRingSetting());
|
||||||
|
state.setRingSettingRotor2(rotor2.getRingSetting());
|
||||||
|
state.setRingSettingRotor3(rotor3.getRingSetting());
|
||||||
|
|
||||||
|
state.setTypeReflector(reflector.getNumber());
|
||||||
|
state.setRotationReflector(reflector.getRotation());
|
||||||
|
state.setRingSettingReflector(reflector.getRingSetting());
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,9 +71,12 @@ public class Reflector
|
||||||
* 3 -> ReflectorC
|
* 3 -> ReflectorC
|
||||||
* 4 -> ReflectorThinB
|
* 4 -> ReflectorThinB
|
||||||
* 5 -> ReflectorThinC
|
* 5 -> ReflectorThinC
|
||||||
* 6 -> ReflectorEnigmaD
|
* 6 -> ReflectorEnigma_D_KD_G31
|
||||||
* 7 -> ReflectorK
|
* 7 -> Reflector_K
|
||||||
* 7 -> ReflectorT
|
* 8 -> Reflector_T
|
||||||
|
* 9 -> Reflector_G312
|
||||||
|
* 10 -> Reflector_G260
|
||||||
|
* 11 -> Reflector_R
|
||||||
* default -> ReflectorB
|
* default -> ReflectorB
|
||||||
* @return Reflector
|
* @return Reflector
|
||||||
*/
|
*/
|
||||||
|
@ -86,9 +89,12 @@ public class Reflector
|
||||||
case 3: return new ReflectorC();
|
case 3: return new ReflectorC();
|
||||||
case 4: return new ReflectorThinB();
|
case 4: return new ReflectorThinB();
|
||||||
case 5: return new ReflectorThinC();
|
case 5: return new ReflectorThinC();
|
||||||
case 6: return new ReflectorEnigmaDKD();
|
case 6: return new ReflectorEnigma_D_KD_G31();
|
||||||
case 7: return new ReflectorEnigmaK();
|
case 7: return new ReflectorEnigma_K();
|
||||||
case 8: return new ReflectorEnigmaT();
|
case 8: return new ReflectorEnigma_T();
|
||||||
|
case 9: return new Reflector_G312();
|
||||||
|
case 10: return new Reflector_G260();
|
||||||
|
case 11: return new Reflector_R();
|
||||||
default: return new ReflectorB();
|
default: return new ReflectorB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,10 +221,10 @@ public class Reflector
|
||||||
* Standard wiring: AI,BM,CE,DT,FG,HR,JY,KS,LQ,NZ,OX,PW,UV
|
* Standard wiring: AI,BM,CE,DT,FG,HR,JY,KS,LQ,NZ,OX,PW,UV
|
||||||
* Has additional ringSetting and can rotate
|
* Has additional ringSetting and can rotate
|
||||||
*/
|
*/
|
||||||
public static class ReflectorEnigmaDKD extends Reflector
|
public static class ReflectorEnigma_D_KD_G31 extends Reflector
|
||||||
{
|
{
|
||||||
public static final int[] defaultWiring = {8,12,4,19,2,6,5,17,0,24,18,16,1,25,23,22,11,7,10,3,21,20,15,14,9,13};
|
public static final int[] defaultWiring = {8,12,4,19,2,6,5,17,0,24,18,16,1,25,23,22,11,7,10,3,21,20,15,14,9,13};
|
||||||
public ReflectorEnigmaDKD()
|
public ReflectorEnigma_D_KD_G31()
|
||||||
{
|
{
|
||||||
super("Ref-D", 6, defaultWiring);
|
super("Ref-D", 6, defaultWiring);
|
||||||
}
|
}
|
||||||
|
@ -234,9 +240,13 @@ public class Reflector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ReflectorEnigmaK extends Reflector
|
/**
|
||||||
|
* Reflector as used in various Enigma models of the K-Series
|
||||||
|
* I M E T C G F R A Y S Q B Z X W L H K D V U P O J N
|
||||||
|
*/
|
||||||
|
private static class ReflectorEnigma_K extends Reflector
|
||||||
{
|
{
|
||||||
public ReflectorEnigmaK()
|
public ReflectorEnigma_K()
|
||||||
{
|
{
|
||||||
super("Ref-K", 7, new int[]{8,12,4,19,2,6,5,17,0,24,18,16,1,25,23,22,11,7,10,3,21,20,15,14,9,13});
|
super("Ref-K", 7, new int[]{8,12,4,19,2,6,5,17,0,24,18,16,1,25,23,22,11,7,10,3,21,20,15,14,9,13});
|
||||||
}
|
}
|
||||||
|
@ -245,12 +255,47 @@ public class Reflector
|
||||||
* Reflector as used in the Enigma type T (Tirpitz)
|
* Reflector as used in the Enigma type T (Tirpitz)
|
||||||
* G E K P B T A U M O C N I L J D X Z Y F H W V Q S R
|
* G E K P B T A U M O C N I L J D X Z Y F H W V Q S R
|
||||||
*/
|
*/
|
||||||
private static class ReflectorEnigmaT extends Reflector
|
private static class ReflectorEnigma_T extends Reflector
|
||||||
{
|
{
|
||||||
public ReflectorEnigmaT()
|
public ReflectorEnigma_T()
|
||||||
{
|
{
|
||||||
super("Ref-T", 8, new int[]{6,4,10,15,1,19,0,20,12,14,2,13,8,11,9,3,23,25,24,5,7,22,21,16,18,17});
|
super("Ref-T", 8, new int[]{6,4,10,15,1,19,0,20,12,14,2,13,8,11,9,3,23,25,24,5,7,22,21,16,18,17});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reflector as used in the Enigma type G-312 Abwehr
|
||||||
|
* R U L Q M Z J S Y G O C E T K W D A H N B X P V I F
|
||||||
|
*/
|
||||||
|
private static class Reflector_G312 extends Reflector
|
||||||
|
{
|
||||||
|
public Reflector_G312()
|
||||||
|
{
|
||||||
|
super("Ref-G312", 9, new int[]{17,20,11,16,12,25,9,18,24,6,14,2,4,19,10,22,3,0,7,13,1,23,15,21,8,5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reflector as used in the Enigma type G-260 Abwehr
|
||||||
|
* I M E T C G F R A Y S Q B Z X W L H K D V U P O J N
|
||||||
|
*/
|
||||||
|
private static class Reflector_G260 extends Reflector
|
||||||
|
{
|
||||||
|
public Reflector_G260()
|
||||||
|
{
|
||||||
|
super("Ref-G260", 10, new int[]{8,12,4,19,2,6,5,17,0,24,18,16,1,25,23,22,11,7,10,3,21,20,15,14,9,13});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reflector as used in the Enigma Type R "Rocket" (Reichsbahn)
|
||||||
|
*/
|
||||||
|
private static class Reflector_R extends Reflector
|
||||||
|
{
|
||||||
|
public Reflector_R()
|
||||||
|
{
|
||||||
|
super("Ref-R", 11, new int[]{16,24,7,14,6,13,4,2,21,15,20,25,19,5,3,9,0,23,22,12,10,8,18,17,1,11});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,39 +79,63 @@ public class Rotor
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0: return new EntryWheelDK();
|
case 0: return new EntryWheel_QWERTZ();
|
||||||
|
|
||||||
case 1: return new RotorI(rotation, ringSetting);
|
case 1: return new Rotor_I(rotation, ringSetting);
|
||||||
case 2: return new RotorII(rotation, ringSetting);
|
case 2: return new Rotor_II(rotation, ringSetting);
|
||||||
case 3: return new RotorIII(rotation, ringSetting);
|
case 3: return new Rotor_III(rotation, ringSetting);
|
||||||
case 4: return new RotorIV(rotation, ringSetting);
|
case 4: return new Rotor_IV(rotation, ringSetting);
|
||||||
case 5: return new RotorV(rotation, ringSetting);
|
case 5: return new Rotor_V(rotation, ringSetting);
|
||||||
case 6: return new RotorVI(rotation, ringSetting);
|
case 6: return new Rotor_VI(rotation, ringSetting);
|
||||||
case 7: return new RotorVII(rotation, ringSetting);
|
case 7: return new Rotor_VII(rotation, ringSetting);
|
||||||
case 8: return new RotorVIII(rotation, ringSetting);
|
case 8: return new Rotor_VIII(rotation, ringSetting);
|
||||||
|
|
||||||
case 9: return new RotorBeta(rotation, ringSetting);
|
case 9: return new Rotor_M4_Beta(rotation, ringSetting);
|
||||||
case 10: return new RotorGamma(rotation, ringSetting);
|
case 10: return new Rotor_M4_Gamma(rotation, ringSetting);
|
||||||
|
|
||||||
case 11: return new RotorDI(rotation, ringSetting);
|
case 11: return new Rotor_D_I(rotation, ringSetting);
|
||||||
case 12: return new RotorDII(rotation, ringSetting);
|
case 12: return new Rotor_D_II(rotation, ringSetting);
|
||||||
case 13: return new RotorDIII(rotation, ringSetting);
|
case 13: return new Rotor_D_III(rotation, ringSetting);
|
||||||
|
|
||||||
case 14: return new RotorKI(rotation, ringSetting);
|
case 14: return new Rotor_KSwiss_Standard_I(rotation, ringSetting);
|
||||||
case 15: return new RotorKII(rotation, ringSetting);
|
case 15: return new Rotor_KSwiss_Standard_II(rotation, ringSetting);
|
||||||
case 16: return new RotorKIII(rotation, ringSetting);
|
case 16: return new Rotor_KSwiss_Standard_III(rotation, ringSetting);
|
||||||
|
|
||||||
case 17: return new EntryWheelT();
|
case 17: return new EntryWheel_T();
|
||||||
case 18: return new RotorTI(rotation, ringSetting);
|
case 18: return new Rotor_T_I(rotation, ringSetting);
|
||||||
case 19: return new RotorTII(rotation, ringSetting);
|
case 19: return new Rotor_T_II(rotation, ringSetting);
|
||||||
case 20: return new RotorTIII(rotation, ringSetting);
|
case 20: return new Rotor_T_III(rotation, ringSetting);
|
||||||
case 21: return new RotorTIV(rotation, ringSetting);
|
case 21: return new Rotor_T_IV(rotation, ringSetting);
|
||||||
case 22: return new RotorTV(rotation, ringSetting);
|
case 22: return new Rotor_T_V(rotation, ringSetting);
|
||||||
case 23: return new RotorTVI(rotation, ringSetting);
|
case 23: return new Rotor_T_VI(rotation, ringSetting);
|
||||||
case 24: return new RotorTVII(rotation, ringSetting);
|
case 24: return new Rotor_T_VII(rotation, ringSetting);
|
||||||
case 25: return new RotorTVIII(rotation, ringSetting);
|
case 25: return new Rotor_T_VIII(rotation, ringSetting);
|
||||||
|
|
||||||
default: return new RotorI(rotation, ringSetting);
|
case 26: return new Rotor_G312_I(rotation, ringSetting);
|
||||||
|
case 27: return new Rotor_G312_II(rotation, ringSetting);
|
||||||
|
case 28: return new Rotor_G312_III(rotation, ringSetting);
|
||||||
|
|
||||||
|
case 29: return new Rotor_G260_I(rotation, ringSetting);
|
||||||
|
case 30: return new Rotor_G260_II(rotation, ringSetting);
|
||||||
|
case 31: return new Rotor_G260_III(rotation, ringSetting);
|
||||||
|
|
||||||
|
case 32: return new Rotor_G31_I(rotation, ringSetting);
|
||||||
|
case 33: return new Rotor_G31_II(rotation, ringSetting);
|
||||||
|
case 34: return new Rotor_G31_III(rotation, ringSetting);
|
||||||
|
|
||||||
|
case 35: return new Rotor_K_I(rotation, ringSetting);
|
||||||
|
case 36: return new Rotor_K_II(rotation, ringSetting);
|
||||||
|
case 37: return new Rotor_K_III(rotation, ringSetting);
|
||||||
|
|
||||||
|
case 38: return new Rotor_K_Swiss_Airforce_I(rotation, ringSetting);
|
||||||
|
case 39: return new Rotor_K_Swiss_Airforce_II(rotation, ringSetting);
|
||||||
|
case 40: return new Rotor_K_Swiss_Airforce_III(rotation, ringSetting);
|
||||||
|
|
||||||
|
case 41: return new Rotor_R_I(rotation, ringSetting);
|
||||||
|
case 42: return new Rotor_R_II(rotation, ringSetting);
|
||||||
|
case 43: return new Rotor_R_III(rotation, ringSetting);
|
||||||
|
|
||||||
|
default: return new Rotor_I(rotation, ringSetting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,9 +273,9 @@ public class Rotor
|
||||||
* Used in Enigma I, M3, M4
|
* Used in Enigma I, M3, M4
|
||||||
* E K M F L G D Q V Z N T O W Y H X U S P A I B R C J
|
* E K M F L G D Q V Z N T O W Y H X U S P A I B R C J
|
||||||
*/
|
*/
|
||||||
private static class RotorI extends Rotor
|
private static class Rotor_I extends Rotor
|
||||||
{
|
{
|
||||||
public RotorI(int rotation, int ringSetting)
|
public Rotor_I(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("I", 1,
|
super("I", 1,
|
||||||
new Integer[]{4, 10, 12, 5, 11, 6, 3, 16, 21, 25, 13, 19, 14, 22, 24, 7, 23, 20, 18, 15, 0, 8, 1, 17, 2, 9},
|
new Integer[]{4, 10, 12, 5, 11, 6, 3, 16, 21, 25, 13, 19, 14, 22, 24, 7, 23, 20, 18, 15, 0, 8, 1, 17, 2, 9},
|
||||||
|
@ -265,9 +289,9 @@ public class Rotor
|
||||||
* Used in Enigma I, M3, M4
|
* Used in Enigma I, M3, M4
|
||||||
* A J D K S I R U X B L H W T M C Q G Z N P Y F V O E
|
* A J D K S I R U X B L H W T M C Q G Z N P Y F V O E
|
||||||
*/
|
*/
|
||||||
private static class RotorII extends Rotor
|
private static class Rotor_II extends Rotor
|
||||||
{
|
{
|
||||||
public RotorII(int rotation, int ringSetting)
|
public Rotor_II(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("II", 2,
|
super("II", 2,
|
||||||
new Integer[]{0, 9, 3, 10, 18, 8, 17, 20, 23, 1, 11, 7, 22, 19, 12, 2, 16, 6, 25, 13, 15, 24, 5, 21, 14, 4},
|
new Integer[]{0, 9, 3, 10, 18, 8, 17, 20, 23, 1, 11, 7, 22, 19, 12, 2, 16, 6, 25, 13, 15, 24, 5, 21, 14, 4},
|
||||||
|
@ -281,9 +305,9 @@ public class Rotor
|
||||||
* Used in Enigma I, M3, M4
|
* Used in Enigma I, M3, M4
|
||||||
* B D F H J L C P R T X V Z N Y E I W G A K M U S Q O
|
* B D F H J L C P R T X V Z N Y E I W G A K M U S Q O
|
||||||
*/
|
*/
|
||||||
private static class RotorIII extends Rotor
|
private static class Rotor_III extends Rotor
|
||||||
{
|
{
|
||||||
public RotorIII(int rotation, int ringSetting)
|
public Rotor_III(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("III", 3,
|
super("III", 3,
|
||||||
new Integer[]{1, 3, 5, 7, 9, 11, 2, 15, 17, 19, 23, 21, 25, 13, 24, 4, 8, 22, 6, 0, 10, 12, 20, 18, 16, 14},
|
new Integer[]{1, 3, 5, 7, 9, 11, 2, 15, 17, 19, 23, 21, 25, 13, 24, 4, 8, 22, 6, 0, 10, 12, 20, 18, 16, 14},
|
||||||
|
@ -297,9 +321,9 @@ public class Rotor
|
||||||
* Used in Enigma M3, M4
|
* Used in Enigma M3, M4
|
||||||
* E S O V P Z J A Y Q U I R H X L N F T G K D C M W B
|
* E S O V P Z J A Y Q U I R H X L N F T G K D C M W B
|
||||||
*/
|
*/
|
||||||
private static class RotorIV extends Rotor
|
private static class Rotor_IV extends Rotor
|
||||||
{
|
{
|
||||||
public RotorIV(int rotation, int ringSetting)
|
public Rotor_IV(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("IV", 4,
|
super("IV", 4,
|
||||||
new Integer[]{4, 18, 14, 21, 15, 25, 9, 0, 24, 16, 20, 8, 17, 7, 23, 11, 13, 5, 19, 6, 10, 3, 2, 12, 22, 1},
|
new Integer[]{4, 18, 14, 21, 15, 25, 9, 0, 24, 16, 20, 8, 17, 7, 23, 11, 13, 5, 19, 6, 10, 3, 2, 12, 22, 1},
|
||||||
|
@ -313,9 +337,9 @@ public class Rotor
|
||||||
* Used in Enigma M3, M4
|
* Used in Enigma M3, M4
|
||||||
* V Z B R G I T Y U P S D N H L X A W M J Q O F E C K
|
* V Z B R G I T Y U P S D N H L X A W M J Q O F E C K
|
||||||
*/
|
*/
|
||||||
private static class RotorV extends Rotor
|
private static class Rotor_V extends Rotor
|
||||||
{
|
{
|
||||||
public RotorV(int rotation, int ringSetting)
|
public Rotor_V(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("V", 5,
|
super("V", 5,
|
||||||
new Integer[]{21, 25, 1, 17, 6, 8, 19, 24, 20, 15, 18, 3, 13, 7, 11, 23, 0, 22, 12, 9, 16, 14, 5, 4, 2, 10},
|
new Integer[]{21, 25, 1, 17, 6, 8, 19, 24, 20, 15, 18, 3, 13, 7, 11, 23, 0, 22, 12, 9, 16, 14, 5, 4, 2, 10},
|
||||||
|
@ -329,9 +353,9 @@ public class Rotor
|
||||||
* Used in Enigma M3, M4
|
* Used in Enigma M3, M4
|
||||||
* J P G V O U M F Y Q B E N H Z R D K A S X L I C T W
|
* J P G V O U M F Y Q B E N H Z R D K A S X L I C T W
|
||||||
*/
|
*/
|
||||||
private static class RotorVI extends Rotor
|
private static class Rotor_VI extends Rotor
|
||||||
{
|
{
|
||||||
public RotorVI(int rotation, int ringSetting)
|
public Rotor_VI(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("VI", 6,
|
super("VI", 6,
|
||||||
new Integer[]{9,15,6,21,14,20,12,5,24,16,1,4,13,7,25,17,3,10,0,18,23,11,8,2,19,22},
|
new Integer[]{9,15,6,21,14,20,12,5,24,16,1,4,13,7,25,17,3,10,0,18,23,11,8,2,19,22},
|
||||||
|
@ -345,9 +369,9 @@ public class Rotor
|
||||||
* Used in Enigma M3, M4
|
* Used in Enigma M3, M4
|
||||||
* N Z J H G R C X M Y S W B O U F A I V L P E K Q D T
|
* N Z J H G R C X M Y S W B O U F A I V L P E K Q D T
|
||||||
*/
|
*/
|
||||||
private static class RotorVII extends Rotor
|
private static class Rotor_VII extends Rotor
|
||||||
{
|
{
|
||||||
public RotorVII(int rotation, int ringSetting)
|
public Rotor_VII(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("VII", 7,
|
super("VII", 7,
|
||||||
new Integer[]{13,25,9,7,6,17,2,23,12,24,18,22,1,14,20,5,0,8,21,11,15,4,10,16,3,19},
|
new Integer[]{13,25,9,7,6,17,2,23,12,24,18,22,1,14,20,5,0,8,21,11,15,4,10,16,3,19},
|
||||||
|
@ -361,9 +385,9 @@ public class Rotor
|
||||||
* Used in Enigma M3, M4
|
* Used in Enigma M3, M4
|
||||||
* F K Q H T L X O C B J S P D Z R A M E W N I U Y G V
|
* F K Q H T L X O C B J S P D Z R A M E W N I U Y G V
|
||||||
*/
|
*/
|
||||||
private static class RotorVIII extends Rotor
|
private static class Rotor_VIII extends Rotor
|
||||||
{
|
{
|
||||||
public RotorVIII(int rotation, int ringSetting)
|
public Rotor_VIII(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("VIII", 8,
|
super("VIII", 8,
|
||||||
new Integer[]{5,10,16,7,19,11,23,14,2,1,9,18,15,3,25,17,0,12,4,22,13,8,20,24,6,21},
|
new Integer[]{5,10,16,7,19,11,23,14,2,1,9,18,15,3,25,17,0,12,4,22,13,8,20,24,6,21},
|
||||||
|
@ -380,9 +404,9 @@ public class Rotor
|
||||||
* That way the M4 was backwards compatible to the M3
|
* That way the M4 was backwards compatible to the M3
|
||||||
* Used in M4
|
* Used in M4
|
||||||
*/
|
*/
|
||||||
private static class RotorBeta extends Rotor
|
private static class Rotor_M4_Beta extends Rotor
|
||||||
{
|
{
|
||||||
public RotorBeta(int rotation, int ringSetting)
|
public Rotor_M4_Beta(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("Beta", 9,
|
super("Beta", 9,
|
||||||
new Integer[]{11,4,24,9,21,2,13,8,23,22,15,1,16,12,3,17,19,0,10,25,6,5,20,7,14,18},
|
new Integer[]{11,4,24,9,21,2,13,8,23,22,15,1,16,12,3,17,19,0,10,25,6,5,20,7,14,18},
|
||||||
|
@ -411,9 +435,9 @@ public class Rotor
|
||||||
* (if rotation == 0). That way the M4 was backwards compatible to the M3
|
* (if rotation == 0). That way the M4 was backwards compatible to the M3
|
||||||
* Used in M4
|
* Used in M4
|
||||||
*/
|
*/
|
||||||
private static class RotorGamma extends Rotor
|
private static class Rotor_M4_Gamma extends Rotor
|
||||||
{
|
{
|
||||||
public RotorGamma(int rotation, int ringSetting)
|
public Rotor_M4_Gamma(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("Gamma", 10,
|
super("Gamma", 10,
|
||||||
new Integer[]{5,18,14,10,0,13,20,4,17,7,12,1,19,8,24,2,22,11,16,15,25,23,21,6,9,3},
|
new Integer[]{5,18,14,10,0,13,20,4,17,7,12,1,19,8,24,2,22,11,16,15,25,23,21,6,9,3},
|
||||||
|
@ -435,12 +459,12 @@ public class Rotor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EntryWheel as used in the Enigma models D, K
|
* EntryWheel as used in the Enigma models D, K, G
|
||||||
* Q W E R T Z U I O A S D F G H J K P Y X C V B N M L
|
* Q W E R T Z U I O A S D F G H J K P Y X C V B N M L
|
||||||
*/
|
*/
|
||||||
private static class EntryWheelDK extends Rotor
|
private static class EntryWheel_QWERTZ extends Rotor
|
||||||
{
|
{
|
||||||
public EntryWheelDK()
|
public EntryWheel_QWERTZ()
|
||||||
{
|
{
|
||||||
super("ETW-D", 0,
|
super("ETW-D", 0,
|
||||||
new Integer[]{9,22,20,11,2,12,13,14,7,15,16,25,24,23,8,17,0,3,10,4,6,21,1,19,18,5},
|
new Integer[]{9,22,20,11,2,12,13,14,7,15,16,25,24,23,8,17,0,3,10,4,6,21,1,19,18,5},
|
||||||
|
@ -466,9 +490,9 @@ public class Rotor
|
||||||
* L P G S Z M H A E O Q K V X R F Y B U T N I C J D W
|
* L P G S Z M H A E O Q K V X R F Y B U T N I C J D W
|
||||||
* Turnover Z
|
* Turnover Z
|
||||||
*/
|
*/
|
||||||
private static class RotorDI extends Rotor
|
private static class Rotor_D_I extends Rotor
|
||||||
{
|
{
|
||||||
public RotorDI(int rotation, int ringSetting)
|
public Rotor_D_I(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("D-I", 11,
|
super("D-I", 11,
|
||||||
new Integer[]{11,15,6,18,25,12,7,0,4,14,16,10,21,23,17,5,24,1,20,19,13,8,2,9,3,22},
|
new Integer[]{11,15,6,18,25,12,7,0,4,14,16,10,21,23,17,5,24,1,20,19,13,8,2,9,3,22},
|
||||||
|
@ -482,9 +506,9 @@ public class Rotor
|
||||||
* S L V G B T F X J Q O H E W I R Z Y A M K P C N D U
|
* S L V G B T F X J Q O H E W I R Z Y A M K P C N D U
|
||||||
* Turnover F
|
* Turnover F
|
||||||
*/
|
*/
|
||||||
private static class RotorDII extends Rotor
|
private static class Rotor_D_II extends Rotor
|
||||||
{
|
{
|
||||||
public RotorDII(int rotation, int ringSetting)
|
public Rotor_D_II(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("D-II", 12,
|
super("D-II", 12,
|
||||||
new Integer[]{18,11,21,6,1,19,5,23,9,16,14,7,4,22,8,17,25,24,0,12,10,15,2,13,3,20},
|
new Integer[]{18,11,21,6,1,19,5,23,9,16,14,7,4,22,8,17,25,24,0,12,10,15,2,13,3,20},
|
||||||
|
@ -498,9 +522,9 @@ public class Rotor
|
||||||
* C J G D P S H K T U R A W Z X F M Y N Q O B V L I E
|
* C J G D P S H K T U R A W Z X F M Y N Q O B V L I E
|
||||||
* Turnover O
|
* Turnover O
|
||||||
*/
|
*/
|
||||||
private static class RotorDIII extends Rotor
|
private static class Rotor_D_III extends Rotor
|
||||||
{
|
{
|
||||||
public RotorDIII(int rotation, int ringSetting)
|
public Rotor_D_III(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("D-III", 13,
|
super("D-III", 13,
|
||||||
new Integer[]{2,9,6,3,15,18,7,10,19,20,17,0,22,25,23,5,12,24,13,16,14,1,21,11,8,4},
|
new Integer[]{2,9,6,3,15,18,7,10,19,20,17,0,22,25,23,5,12,24,13,16,14,1,21,11,8,4},
|
||||||
|
@ -514,11 +538,11 @@ public class Rotor
|
||||||
* P E Z U O H X S C V F M T B G L R I N Q J W A Y D K
|
* P E Z U O H X S C V F M T B G L R I N Q J W A Y D K
|
||||||
* Turnover Z
|
* Turnover Z
|
||||||
*/
|
*/
|
||||||
private static class RotorKI extends Rotor
|
private static class Rotor_KSwiss_Standard_I extends Rotor
|
||||||
{
|
{
|
||||||
public RotorKI(int rotation, int ringSetting)
|
public Rotor_KSwiss_Standard_I(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("K-I", 14,
|
super("KS-I", 14,
|
||||||
new Integer[]{15,4,25,20,14,7,23,18,2,21,5,12,19,1,6,11,17,8,13,16,9,22,0,24,3,10},
|
new Integer[]{15,4,25,20,14,7,23,18,2,21,5,12,19,1,6,11,17,8,13,16,9,22,0,24,3,10},
|
||||||
new Integer[]{22,13,8,24,1,10,14,5,17,20,25,15,11,18,4,0,19,16,7,12,3,9,21,6,23,2},
|
new Integer[]{22,13,8,24,1,10,14,5,17,20,25,15,11,18,4,0,19,16,7,12,3,9,21,6,23,2},
|
||||||
new Integer[]{25}, ringSetting, rotation);
|
new Integer[]{25}, ringSetting, rotation);
|
||||||
|
@ -530,11 +554,11 @@ public class Rotor
|
||||||
* Z O U E S Y D K F W P C I Q X H M V B L G N J R A T
|
* Z O U E S Y D K F W P C I Q X H M V B L G N J R A T
|
||||||
* Turnover F
|
* Turnover F
|
||||||
*/
|
*/
|
||||||
private static class RotorKII extends Rotor
|
private static class Rotor_KSwiss_Standard_II extends Rotor
|
||||||
{
|
{
|
||||||
public RotorKII(int rotation, int ringSetting)
|
public Rotor_KSwiss_Standard_II(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("K-II", 15,
|
super("KS-II", 15,
|
||||||
new Integer[]{25,14,20,4,18,24,3,10,5,22,15,2,8,16,23,7,12,21,1,11,6,13,9,17,0,19},
|
new Integer[]{25,14,20,4,18,24,3,10,5,22,15,2,8,16,23,7,12,21,1,11,6,13,9,17,0,19},
|
||||||
new Integer[]{24,18,11,6,3,8,20,15,12,22,7,19,16,21,1,10,13,23,4,25,2,17,9,14,5,0},
|
new Integer[]{24,18,11,6,3,8,20,15,12,22,7,19,16,21,1,10,13,23,4,25,2,17,9,14,5,0},
|
||||||
new Integer[]{5}, ringSetting, rotation);
|
new Integer[]{5}, ringSetting, rotation);
|
||||||
|
@ -546,11 +570,11 @@ public class Rotor
|
||||||
* E H R V X G A O B Q U S I M Z F L Y N W K T P D J C
|
* E H R V X G A O B Q U S I M Z F L Y N W K T P D J C
|
||||||
* Turnover O
|
* Turnover O
|
||||||
*/
|
*/
|
||||||
private static class RotorKIII extends Rotor
|
private static class Rotor_KSwiss_Standard_III extends Rotor
|
||||||
{
|
{
|
||||||
public RotorKIII(int rotation, int ringSetting)
|
public Rotor_KSwiss_Standard_III(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("K-III", 16,
|
super("KS-III", 16,
|
||||||
new Integer[]{4,7,17,21,23,6,0,14,1,16,20,18,8,12,25,5,11,24,13,22,10,19,15,3,9,2},
|
new Integer[]{4,7,17,21,23,6,0,14,1,16,20,18,8,12,25,5,11,24,13,22,10,19,15,3,9,2},
|
||||||
new Integer[]{6,8,25,23,0,15,5,1,12,24,20,16,13,18,7,22,9,2,11,21,10,3,19,4,17,14},
|
new Integer[]{6,8,25,23,0,15,5,1,12,24,20,16,13,18,7,22,9,2,11,21,10,3,19,4,17,14},
|
||||||
new Integer[]{14}, ringSetting, rotation);
|
new Integer[]{14}, ringSetting, rotation);
|
||||||
|
@ -561,9 +585,9 @@ public class Rotor
|
||||||
* EntryWheel as used only in the Enigma Type T Tirpitz
|
* EntryWheel as used only in the Enigma Type T Tirpitz
|
||||||
* K Z R O U Q H Y A I G B L W V S T D X F P N M C J E
|
* K Z R O U Q H Y A I G B L W V S T D X F P N M C J E
|
||||||
*/
|
*/
|
||||||
private static class EntryWheelT extends Rotor
|
private static class EntryWheel_T extends Rotor
|
||||||
{
|
{
|
||||||
public EntryWheelT()
|
public EntryWheel_T()
|
||||||
{
|
{
|
||||||
super("T-ETW", 17,
|
super("T-ETW", 17,
|
||||||
new Integer[]{8,11,23,17,25,19,10,6,9,24,0,12,22,21,3,20,5,2,15,16,4,14,13,18,7,1},
|
new Integer[]{8,11,23,17,25,19,10,6,9,24,0,12,22,21,3,20,5,2,15,16,4,14,13,18,7,1},
|
||||||
|
@ -588,9 +612,9 @@ public class Rotor
|
||||||
* K P T Y U E L O C V G R F Q D A N J M B S W H Z X I
|
* K P T Y U E L O C V G R F Q D A N J M B S W H Z X I
|
||||||
* Turnover X A F L R
|
* Turnover X A F L R
|
||||||
*/
|
*/
|
||||||
private static class RotorTI extends Rotor
|
private static class Rotor_T_I extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTI(int rotation, int ringSetting)
|
public Rotor_T_I(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-I", 18,
|
super("T-I", 18,
|
||||||
new Integer[]{10,15,19,24,20,4,11,14,2,21,6,17,5,16,3,0,13,9,12,1,18,22,7,25,23,8},
|
new Integer[]{10,15,19,24,20,4,11,14,2,21,6,17,5,16,3,0,13,9,12,1,18,22,7,25,23,8},
|
||||||
|
@ -604,9 +628,9 @@ public class Rotor
|
||||||
* U P H Z L W E Q M T D J X C A K S O I G V B Y F N R
|
* U P H Z L W E Q M T D J X C A K S O I G V B Y F N R
|
||||||
* Turnover X A G M S
|
* Turnover X A G M S
|
||||||
*/
|
*/
|
||||||
private static class RotorTII extends Rotor
|
private static class Rotor_T_II extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTII(int rotation, int ringSetting)
|
public Rotor_T_II(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-II", 19,
|
super("T-II", 19,
|
||||||
new Integer[]{20,15,7,25,11,22,4,16,12,19,3,9,23,2,0,10,18,14,8,6,21,1,24,5,13,17},
|
new Integer[]{20,15,7,25,11,22,4,16,12,19,3,9,23,2,0,10,18,14,8,6,21,1,24,5,13,17},
|
||||||
|
@ -620,9 +644,9 @@ public class Rotor
|
||||||
* Q U D L Y R F E K O N V Z A X W H M G P J B S I C T
|
* Q U D L Y R F E K O N V Z A X W H M G P J B S I C T
|
||||||
* Turnover X A F L R
|
* Turnover X A F L R
|
||||||
*/
|
*/
|
||||||
private static class RotorTIII extends Rotor
|
private static class Rotor_T_III extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTIII(int rotation, int ringSetting) {
|
public Rotor_T_III(int rotation, int ringSetting) {
|
||||||
super("T-III", 20,
|
super("T-III", 20,
|
||||||
new Integer[]{16,20,3,11,24,17,5,4,10,14,13,21,25,0,23,22,7,12,6,15,9,1,18,8,2,19},
|
new Integer[]{16,20,3,11,24,17,5,4,10,14,13,21,25,0,23,22,7,12,6,15,9,1,18,8,2,19},
|
||||||
new Integer[]{13,21,24,2,7,6,18,16,23,20,8,3,17,10,9,19,0,5,22,25,1,11,15,14,4,12},
|
new Integer[]{13,21,24,2,7,6,18,16,23,20,8,3,17,10,9,19,0,5,22,25,1,11,15,14,4,12},
|
||||||
|
@ -635,9 +659,9 @@ public class Rotor
|
||||||
* C I W T B K X N R E S P F L Y D A G V H Q U O J Z M
|
* C I W T B K X N R E S P F L Y D A G V H Q U O J Z M
|
||||||
* Turnover X A G M S
|
* Turnover X A G M S
|
||||||
*/
|
*/
|
||||||
private static class RotorTIV extends Rotor
|
private static class Rotor_T_IV extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTIV(int rotation, int ringSetting)
|
public Rotor_T_IV(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-IV", 21,
|
super("T-IV", 21,
|
||||||
new Integer[]{2,8,22,19,1,10,23,13,17,4,18,15,5,11,24,3,0,6,21,7,16,20,14,9,25,12},
|
new Integer[]{2,8,22,19,1,10,23,13,17,4,18,15,5,11,24,3,0,6,21,7,16,20,14,9,25,12},
|
||||||
|
@ -651,9 +675,9 @@ public class Rotor
|
||||||
* U A X G I S N J B V E R D Y L F Z W T P C K O H M Q
|
* U A X G I S N J B V E R D Y L F Z W T P C K O H M Q
|
||||||
* Turnover Z D G L S
|
* Turnover Z D G L S
|
||||||
*/
|
*/
|
||||||
private static class RotorTV extends Rotor
|
private static class Rotor_T_V extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTV(int rotation, int ringSetting)
|
public Rotor_T_V(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-V", 22,
|
super("T-V", 22,
|
||||||
new Integer[]{20,0,23,6,8,18,13,9,1,21,4,17,3,24,11,5,25,22,19,15,2,10,14,7,12,16},
|
new Integer[]{20,0,23,6,8,18,13,9,1,21,4,17,3,24,11,5,25,22,19,15,2,10,14,7,12,16},
|
||||||
|
@ -667,9 +691,9 @@ public class Rotor
|
||||||
* X F U Z G A L V H C N Y S E W Q T D M R B K P I O J
|
* X F U Z G A L V H C N Y S E W Q T D M R B K P I O J
|
||||||
* Turnover Y F J N R
|
* Turnover Y F J N R
|
||||||
*/
|
*/
|
||||||
private static class RotorTVI extends Rotor
|
private static class Rotor_T_VI extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTVI(int rotation, int ringSetting)
|
public Rotor_T_VI(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-VI", 23,
|
super("T-VI", 23,
|
||||||
new Integer[]{23,5,20,25,6,0,11,21,7,2,13,24,18,4,22,16,19,3,12,17,1,10,15,8,14,9},
|
new Integer[]{23,5,20,25,6,0,11,21,7,2,13,24,18,4,22,16,19,3,12,17,1,10,15,8,14,9},
|
||||||
|
@ -683,9 +707,9 @@ public class Rotor
|
||||||
* B J V F T X P L N A Y O Z I K W G D Q E R U C H S M
|
* B J V F T X P L N A Y O Z I K W G D Q E R U C H S M
|
||||||
* Turnover Z D G L S
|
* Turnover Z D G L S
|
||||||
*/
|
*/
|
||||||
private static class RotorTVII extends Rotor
|
private static class Rotor_T_VII extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTVII(int rotation, int ringSetting)
|
public Rotor_T_VII(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-VII", 24,
|
super("T-VII", 24,
|
||||||
new Integer[]{1,9,21,5,19,23,15,11,13,0,24,14,25,8,10,22,6,3,16,4,17,20,2,7,18,12},
|
new Integer[]{1,9,21,5,19,23,15,11,13,0,24,14,25,8,10,22,6,3,16,4,17,20,2,7,18,12},
|
||||||
|
@ -699,9 +723,9 @@ public class Rotor
|
||||||
* Y M T P N Z H W K O D A J X E L U Q V G C B I S F R
|
* Y M T P N Z H W K O D A J X E L U Q V G C B I S F R
|
||||||
* Turnover Y F J N R
|
* Turnover Y F J N R
|
||||||
*/
|
*/
|
||||||
private static class RotorTVIII extends Rotor
|
private static class Rotor_T_VIII extends Rotor
|
||||||
{
|
{
|
||||||
public RotorTVIII(int rotation, int ringSetting)
|
public Rotor_T_VIII(int rotation, int ringSetting)
|
||||||
{
|
{
|
||||||
super("T-VIII", 25,
|
super("T-VIII", 25,
|
||||||
new Integer[]{24,12,19,15,13,25,7,22,10,14,3,0,9,23,4,11,20,16,21,6,2,1,8,18,5,17},
|
new Integer[]{24,12,19,15,13,25,7,22,10,14,3,0,9,23,4,11,20,16,21,6,2,1,8,18,5,17},
|
||||||
|
@ -709,4 +733,290 @@ public class Rotor
|
||||||
new Integer[]{24,5,9,13,17}, ringSetting, rotation);
|
new Integer[]{24,5,9,13,17}, ringSetting, rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor I as used in the Enigma Type G312 Abwehr
|
||||||
|
* D M T W S I L R U Y Q N K F E J C A Z B P G X O H V
|
||||||
|
* Turnover T V W X A B C D F G H J L M P Q R
|
||||||
|
*/
|
||||||
|
private static class Rotor_G312_I extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G312_I(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G312-I", 26,
|
||||||
|
new Integer[]{3,12,19,22,18,8,11,17,20,24,16,13,10,5,4,9,2,0,25,1,15,6,23,14,7,21},
|
||||||
|
new Integer[]{17,19,16,0,14,13,21,24,5,15,12,6,1,11,23,20,10,7,4,2,8,25,3,22,9,18},
|
||||||
|
new Integer[]{19,21,22,23,0,1,2,3,5,6,7,9,11,12,15,16,17}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor II as used in the Enigma Type G312 Abwehr
|
||||||
|
* H Q Z G P J T M O B L N C I F D Y A W V E U S R K X
|
||||||
|
* Turnover T U W Z A B D E G H I L N O R
|
||||||
|
*/
|
||||||
|
private static class Rotor_G312_II extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G312_II(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G312-II", 27,
|
||||||
|
new Integer[]{7,16,25,6,15,9,19,12,14,1,11,13,2,8,5,3,24,0,22,21,4,20,18,17,10,23},
|
||||||
|
new Integer[]{17,9,12,15,20,14,3,0,13,5,24,10,7,11,8,4,1,23,22,6,21,19,18,25,16,2},
|
||||||
|
new Integer[]{19,20,22,25,0,1,3,4,6,7,8,11,13,14,17}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor III as used in the Enigma Type G312 Abwehr
|
||||||
|
* U Q N T L S Z F M R E H D P X K I B V Y G J C W O A
|
||||||
|
* Turnover V X Y B F G I L N O S
|
||||||
|
*/
|
||||||
|
private static class Rotor_G312_III extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G312_III(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G312-III", 28,
|
||||||
|
new Integer[]{20,16,13,19,11,18,25,5,12,17,4,7,3,15,23,10,8,1,21,24,6,9,2,22,14,0},
|
||||||
|
new Integer[]{25,17,22,12,10,7,20,11,16,21,15,4,8,2,24,13,1,9,5,3,0,18,23,14,19,6},
|
||||||
|
new Integer[]{21,23,24,1,5,6,8,11,13,14,18}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor I as used in the Enigma Type G260 Abwehr
|
||||||
|
* R C S P B L K Q A U M H W Y T I F Z V G O J N E X D
|
||||||
|
* Turnover T V W X A B C D F G H J L M P Q R
|
||||||
|
*/
|
||||||
|
private static class Rotor_G260_I extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G260_I(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G260-I", 29,
|
||||||
|
new Integer[]{17,2,18,15,1,11,10,16,0,20,12,7,22,24,19,8,5,25,21,6,14,9,13,4,23,3},
|
||||||
|
new Integer[]{8,4,1,25,23,16,19,11,15,21,6,5,10,22,20,3,7,0,2,14,9,18,12,24,13,17},
|
||||||
|
new Integer[]{19,21,22,23,0,1,2,3,5,6,7,9,11,12,15,16,17}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor II as used in the Enigma Type G260 Abwehr
|
||||||
|
* W C M I B V P J X A R O S G N D L Z K E Y H U F Q T
|
||||||
|
* Turnover T U W Z A B D E G H I L N O R
|
||||||
|
*/
|
||||||
|
private static class Rotor_G260_II extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G260_II(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G260-II", 30,
|
||||||
|
new Integer[]{22,2,12,8,1,21,15,9,23,0,17,14,18,6,13,3,11,25,10,4,24,7,20,5,16,19},
|
||||||
|
new Integer[]{9,4,1,15,19,23,13,21,3,7,18,16,2,14,11,6,24,10,12,25,22,5,0,8,20,17},
|
||||||
|
new Integer[]{19,20,22,25,0,1,3,4,6,7,8,11,13,14,17}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor III as used in the Enigma Type G260 Abwehr
|
||||||
|
* F V D H Z E L S Q M A X O K Y I W P G C B U J T N R
|
||||||
|
* Turnover V X Y B F G I L N O S
|
||||||
|
*/
|
||||||
|
private static class Rotor_G260_III extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G260_III(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G260-III", 31,
|
||||||
|
new Integer[]{5,21,3,7,25,4,11,18,16,12,0,23,14,10,24,8,22,15,6,2,1,20,9,19,13,17},
|
||||||
|
new Integer[]{10,20,19,2,5,0,18,3,15,22,13,6,9,24,12,17,8,25,7,23,21,1,16,11,14,4},
|
||||||
|
new Integer[]{21,23,24,1,5,6,8,11,13,14,18}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor I as used in the Enigma Type G31 Abwehr
|
||||||
|
* L P G S Z M H A E O Q K V X R F Y B U T N I C J D W
|
||||||
|
* Turnover T V W X A B C D F G H J L M P Q R
|
||||||
|
*/
|
||||||
|
private static class Rotor_G31_I extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G31_I(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G31-I", 32,
|
||||||
|
new Integer[]{11,15,6,18,25,12,7,0,4,14,16,10,21,23,17,5,24,1,20,19,13,8,2,9,3,22},
|
||||||
|
new Integer[]{7,17,22,24,8,15,2,6,21,23,11,0,5,20,9,1,10,14,3,19,18,12,25,13,16,4},
|
||||||
|
new Integer[]{19,21,22,23,0,1,2,3,5,6,7,9,11,12,15,16,17}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor II as used in the Enigma Type G31 Abwehr
|
||||||
|
* S L V G B T F X J Q O H E W I R Z Y A M K P C N D U
|
||||||
|
* Turnover T U W Z A B D E G H I L N O R
|
||||||
|
*/
|
||||||
|
private static class Rotor_G31_II extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G31_II(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G31_II", 33,
|
||||||
|
new Integer[]{18,11,21,6,1,19,5,23,9,16,14,7,4,22,8,17,25,24,0,12,10,15,2,13,3,20},
|
||||||
|
new Integer[]{18,4,22,24,12,6,3,11,14,8,20,1,19,23,10,21,9,15,0,5,25,2,13,7,17,16},
|
||||||
|
new Integer[]{19,20,22,25,0,1,3,4,6,7,8,11,13,14,17}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor III as used in the Enigma Type G31 Abwehr
|
||||||
|
* C J G D P S H K T U R A W Z X F M Y N Q O B V L I E
|
||||||
|
* Turnover V X Y B F G I L N O S
|
||||||
|
*/
|
||||||
|
private static class Rotor_G31_III extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_G31_III(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("G31_III", 34,
|
||||||
|
new Integer[]{2,9,6,3,15,18,7,10,19,20,17,0,22,25,23,5,12,24,13,16,14,1,21,11,8,4},
|
||||||
|
new Integer[]{11,21,0,3,25,15,2,6,24,1,7,23,16,18,20,4,19,10,5,8,9,22,12,14,17,13},
|
||||||
|
new Integer[]{21,23,24,1,5,6,8,11,13,14,18}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor I as used in the Enigma Type K
|
||||||
|
* L P G S Z M H A E O Q K V X R F Y B U T N I C J D W
|
||||||
|
* Turnover Z
|
||||||
|
*/
|
||||||
|
private static class Rotor_K_I extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_K_I(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("K-I", 35,
|
||||||
|
new Integer[]{11,15,6,18,25,12,7,0,4,14,16,10,21,23,17,5,24,1,20,19,13,8,2,9,3,22},
|
||||||
|
new Integer[]{7,17,22,24,8,15,2,6,21,23,11,0,5,20,9,1,10,14,3,19,18,12,25,13,16,4},
|
||||||
|
new Integer[]{25}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor II as used in the Enigma type K
|
||||||
|
* S L V G B T F X J Q O H E W I R Z Y A M K P C N D U
|
||||||
|
* Turnover F
|
||||||
|
*/
|
||||||
|
private static class Rotor_K_II extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_K_II(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("K-II", 36,
|
||||||
|
new Integer[]{18,11,21,6,1,19,5,23,9,16,14,7,4,22,8,17,25,24,0,12,10,15,2,13,3,20},
|
||||||
|
new Integer[]{18,4,22,24,12,6,3,11,14,8,20,1,19,23,10,21,9,15,0,5,25,2,13,7,17,16},
|
||||||
|
new Integer[]{5}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor III as used in the Enigma Type K
|
||||||
|
* C J G D P S H K T U R A W Z X F M Y N Q O B V L I E
|
||||||
|
* Turnover O
|
||||||
|
*/
|
||||||
|
private static class Rotor_K_III extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_K_III(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("K-III", 37,
|
||||||
|
new Integer[]{2,9,6,3,15,18,7,10,19,20,17,0,22,25,23,5,12,24,13,16,14,1,21,11,8,4},
|
||||||
|
new Integer[]{11,21,0,3,25,15,2,6,24,1,7,23,16,18,20,4,19,10,5,8,9,22,12,14,17,13},
|
||||||
|
new Integer[]{14}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor I as used in the Enigma Type K (Swiss, Airforce)
|
||||||
|
* PEZUOHXSCVFMTBGLRINQJWAYDK
|
||||||
|
* Turnover Z
|
||||||
|
*/
|
||||||
|
private static class Rotor_K_Swiss_Airforce_I extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_K_Swiss_Airforce_I(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("KSA-I", 38,
|
||||||
|
new Integer[]{15,4,25,20,14,7,23,18,2,21,5,12,19,1,6,11,17,8,13,16,9,22,0,24,3,10},
|
||||||
|
new Integer[]{22,13,8,24,1,10,14,5,17,20,25,15,11,18,4,0,19,16,7,12,3,9,21,6,23,2},
|
||||||
|
new Integer[]{25}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Rotor II as used in the Enigma Type K (Swiss, Airforce)
|
||||||
|
* ZOUESYDKFWPCIQXHMVBLGNJRAT
|
||||||
|
* Turnover F
|
||||||
|
*/
|
||||||
|
private static class Rotor_K_Swiss_Airforce_II extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_K_Swiss_Airforce_II(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("KSA-II", 39,
|
||||||
|
new Integer[]{25,14,20,4,18,24,3,10,5,22,15,2,8,16,23,7,12,21,1,11,6,13,9,17,0,19},
|
||||||
|
new Integer[]{24,18,11,6,3,8,20,15,12,22,7,19,16,21,1,10,13,23,4,25,2,17,9,14,5,0},
|
||||||
|
new Integer[]{5}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Rotor III as used in the Enigma Type K (Swiss, Airforce)
|
||||||
|
* EHRVXGAOBQUSIMZFLYNWKTPDJC
|
||||||
|
* Turnover O
|
||||||
|
*/
|
||||||
|
private static class Rotor_K_Swiss_Airforce_III extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_K_Swiss_Airforce_III(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("KSA-III", 40,
|
||||||
|
new Integer[]{4,7,17,21,23,6,0,14,1,16,20,18,8,12,25,5,11,24,13,22,10,19,15,3,9,2},
|
||||||
|
new Integer[]{6,8,25,23,0,15,5,1,12,24,20,16,13,18,7,22,9,2,11,21,10,3,19,4,17,14},
|
||||||
|
new Integer[]{14}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor I as used in the Enigma Type R (Rocket)
|
||||||
|
* JGDQOXUSCAMIFRVTPNEWKBLZYH
|
||||||
|
* Turnover O
|
||||||
|
*/
|
||||||
|
private static class Rotor_R_I extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_R_I(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("R-I", 41,
|
||||||
|
new Integer[]{9,6,3,16,14,23,20,18,2,0,12,8,5,17,21,19,15,13,4,22,10,1,11,25,24,7},
|
||||||
|
new Integer[]{9,21,8,2,18,12,1,25,11,0,20,22,10,17,4,16,3,13,7,15,6,14,19,5,24,23},
|
||||||
|
new Integer[]{14}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor II as used in the Enigma Type R (Rocket)
|
||||||
|
* NTZPSFBOKMWRCJDIVLAEYUXHGQ
|
||||||
|
* Turnover F
|
||||||
|
*/
|
||||||
|
private static class Rotor_R_II extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_R_II(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("R-II", 42,
|
||||||
|
new Integer[]{13,19,25,15,18,5,1,14,10,12,22,17,2,9,3,8,21,11,0,4,24,20,23,7,6,16},
|
||||||
|
new Integer[]{18,6,12,14,19,5,24,23,15,13,8,17,9,0,7,3,25,11,4,1,21,16,10,22,20,2},
|
||||||
|
new Integer[]{5}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotor III as used in the Enigma Type R (Rocket)
|
||||||
|
* JVIUBHTCDYAKEQZPOSGXNRMWFL
|
||||||
|
* Turnover Z
|
||||||
|
*/
|
||||||
|
private static class Rotor_R_III extends Rotor
|
||||||
|
{
|
||||||
|
public Rotor_R_III(int rotation, int ringSetting)
|
||||||
|
{
|
||||||
|
super("R-III", 43,
|
||||||
|
new Integer[]{9,21,8,20,1,7,19,2,3,24,0,10,4,16,25,15,14,18,6,23,13,17,12,22,5,11},
|
||||||
|
new Integer[]{10,4,7,8,12,24,18,5,2,0,11,25,22,20,16,15,13,21,17,6,3,1,23,19,9,14},
|
||||||
|
new Integer[]{25}, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,20 @@ public abstract class LayoutContainer
|
||||||
return new LayoutContainer_D();
|
return new LayoutContainer_D();
|
||||||
case "K":
|
case "K":
|
||||||
return new LayoutContainer_K();
|
return new LayoutContainer_K();
|
||||||
|
case "KS":
|
||||||
|
return new LayoutContainer_K_Swiss();
|
||||||
|
case "KSA":
|
||||||
|
return new LayoutContainer_K_Swiss_Airforce();
|
||||||
case "T":
|
case "T":
|
||||||
return new LayoutContainer_T();
|
return new LayoutContainer_T();
|
||||||
|
case "R":
|
||||||
|
return new LayoutContainer_R();
|
||||||
|
case "G31":
|
||||||
|
return new LayoutContainer_G31();
|
||||||
|
case "G312":
|
||||||
|
return new LayoutContainer_G312();
|
||||||
|
case "G260":
|
||||||
|
return new LayoutContainer_G260();
|
||||||
default:
|
default:
|
||||||
return new LayoutContainer_I();
|
return new LayoutContainer_I();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.Enigma_D;
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concrete LayoutContainer for the M3 layout.
|
* Concrete LayoutContainer for the D layout.
|
||||||
* This class contains the layout and controls the layout elements such as spinners and stuff
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
* Copyright (C) 2015 Paul Schaub
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.layout;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.R;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_G260;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutContainer for the Enigma Model G260
|
||||||
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class LayoutContainer_G260 extends LayoutContainer
|
||||||
|
{
|
||||||
|
private Enigma_G260 enigma;
|
||||||
|
|
||||||
|
protected int offsetRot = 29;
|
||||||
|
|
||||||
|
protected Spinner rotor1View;
|
||||||
|
protected Spinner rotor2View;
|
||||||
|
protected Spinner rotor3View;
|
||||||
|
|
||||||
|
protected Spinner rotor1PositionView;
|
||||||
|
protected Spinner rotor2PositionView;
|
||||||
|
protected Spinner rotor3PositionView;
|
||||||
|
protected Spinner reflectorPositionView;
|
||||||
|
|
||||||
|
public LayoutContainer_G260()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
main.setTitle("G260 - EnigmAndroid");
|
||||||
|
this.resetLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enigma getEnigma() {
|
||||||
|
return this.enigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeLayout() {
|
||||||
|
this.rotor1View = (Spinner) main.findViewById(R.id.rotor1);
|
||||||
|
this.rotor2View = (Spinner) main.findViewById(R.id.rotor2);
|
||||||
|
this.rotor3View = (Spinner) main.findViewById(R.id.rotor3);
|
||||||
|
this.rotor1PositionView = (Spinner) main.findViewById(R.id.rotor1position);
|
||||||
|
this.rotor2PositionView = (Spinner) main.findViewById(R.id.rotor2position);
|
||||||
|
this.rotor3PositionView = (Spinner) main.findViewById(R.id.rotor3position);
|
||||||
|
this.reflectorPositionView = (Spinner) main.findViewById(R.id.reflector_position);
|
||||||
|
|
||||||
|
Character[] rotorPositionArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {rotorPositionArray[i] = (char) (65+i); /**Fill with A..Z*/}
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1View.setAdapter(rotor1Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2View.setAdapter(rotor2Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3View.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor1PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1PositionView.setAdapter(rotor1PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor2PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2PositionView.setAdapter(rotor2PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor3PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3PositionView.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> reflectorPositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
reflectorPositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
reflectorPositionView.setAdapter(reflectorPositionAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetLayout() {
|
||||||
|
enigma = new Enigma_G260();
|
||||||
|
setLayoutState(enigma.getState());
|
||||||
|
output.setText("");
|
||||||
|
input.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
this.rotor1View.setSelection(state.getTypeRotor1() - offsetRot);
|
||||||
|
this.rotor2View.setSelection(state.getTypeRotor2() - offsetRot);
|
||||||
|
this.rotor3View.setSelection(state.getTypeRotor3() - offsetRot);
|
||||||
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
this.reflectorPositionView.setSelection(state.getRotationReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshState()
|
||||||
|
{
|
||||||
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationReflector(reflectorPositionView.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRingSettingsDialog()
|
||||||
|
{
|
||||||
|
new RingSettingsDialogBuilder.RingSettingsDialogBuilderRotRotRotRef().
|
||||||
|
createRingSettingsDialog(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.layout;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.R;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_G31;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutContainer for the Enigma Model G31
|
||||||
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class LayoutContainer_G31 extends LayoutContainer
|
||||||
|
{
|
||||||
|
private Enigma_G31 enigma;
|
||||||
|
|
||||||
|
protected int offsetRot = 32;
|
||||||
|
|
||||||
|
protected Spinner rotor1View;
|
||||||
|
protected Spinner rotor2View;
|
||||||
|
protected Spinner rotor3View;
|
||||||
|
|
||||||
|
protected Spinner rotor1PositionView;
|
||||||
|
protected Spinner rotor2PositionView;
|
||||||
|
protected Spinner rotor3PositionView;
|
||||||
|
protected Spinner reflectorPositionView;
|
||||||
|
|
||||||
|
public LayoutContainer_G31()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
main.setTitle("G31 - EnigmAndroid");
|
||||||
|
this.resetLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enigma getEnigma() {
|
||||||
|
return this.enigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeLayout() {
|
||||||
|
this.rotor1View = (Spinner) main.findViewById(R.id.rotor1);
|
||||||
|
this.rotor2View = (Spinner) main.findViewById(R.id.rotor2);
|
||||||
|
this.rotor3View = (Spinner) main.findViewById(R.id.rotor3);
|
||||||
|
this.rotor1PositionView = (Spinner) main.findViewById(R.id.rotor1position);
|
||||||
|
this.rotor2PositionView = (Spinner) main.findViewById(R.id.rotor2position);
|
||||||
|
this.rotor3PositionView = (Spinner) main.findViewById(R.id.rotor3position);
|
||||||
|
this.reflectorPositionView = (Spinner) main.findViewById(R.id.reflector_position);
|
||||||
|
|
||||||
|
Character[] rotorPositionArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {rotorPositionArray[i] = (char) (65+i); /**Fill with A..Z*/}
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1View.setAdapter(rotor1Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2View.setAdapter(rotor2Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3View.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor1PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1PositionView.setAdapter(rotor1PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor2PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2PositionView.setAdapter(rotor2PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor3PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3PositionView.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> reflectorPositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
reflectorPositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
reflectorPositionView.setAdapter(reflectorPositionAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetLayout() {
|
||||||
|
enigma = new Enigma_G31();
|
||||||
|
setLayoutState(enigma.getState());
|
||||||
|
output.setText("");
|
||||||
|
input.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
this.rotor1View.setSelection(state.getTypeRotor1() - offsetRot);
|
||||||
|
this.rotor2View.setSelection(state.getTypeRotor2() - offsetRot);
|
||||||
|
this.rotor3View.setSelection(state.getTypeRotor3() - offsetRot);
|
||||||
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
this.reflectorPositionView.setSelection(state.getRotationReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshState()
|
||||||
|
{
|
||||||
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationReflector(reflectorPositionView.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRingSettingsDialog()
|
||||||
|
{
|
||||||
|
new RingSettingsDialogBuilder.RingSettingsDialogBuilderRotRotRotRef().
|
||||||
|
createRingSettingsDialog(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.layout;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.R;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_G312;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutContainer for the Enigma Model G312
|
||||||
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class LayoutContainer_G312 extends LayoutContainer
|
||||||
|
{
|
||||||
|
private Enigma_G312 enigma;
|
||||||
|
|
||||||
|
protected int offsetRot = 26;
|
||||||
|
|
||||||
|
protected Spinner rotor1View;
|
||||||
|
protected Spinner rotor2View;
|
||||||
|
protected Spinner rotor3View;
|
||||||
|
|
||||||
|
protected Spinner rotor1PositionView;
|
||||||
|
protected Spinner rotor2PositionView;
|
||||||
|
protected Spinner rotor3PositionView;
|
||||||
|
protected Spinner reflectorPositionView;
|
||||||
|
|
||||||
|
public LayoutContainer_G312()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
main.setTitle("G312 - EnigmAndroid");
|
||||||
|
this.resetLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enigma getEnigma() {
|
||||||
|
return this.enigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeLayout() {
|
||||||
|
this.rotor1View = (Spinner) main.findViewById(R.id.rotor1);
|
||||||
|
this.rotor2View = (Spinner) main.findViewById(R.id.rotor2);
|
||||||
|
this.rotor3View = (Spinner) main.findViewById(R.id.rotor3);
|
||||||
|
this.rotor1PositionView = (Spinner) main.findViewById(R.id.rotor1position);
|
||||||
|
this.rotor2PositionView = (Spinner) main.findViewById(R.id.rotor2position);
|
||||||
|
this.rotor3PositionView = (Spinner) main.findViewById(R.id.rotor3position);
|
||||||
|
this.reflectorPositionView = (Spinner) main.findViewById(R.id.reflector_position);
|
||||||
|
|
||||||
|
Character[] rotorPositionArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {rotorPositionArray[i] = (char) (65+i); /**Fill with A..Z*/}
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1View.setAdapter(rotor1Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2View.setAdapter(rotor2Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3View.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor1PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1PositionView.setAdapter(rotor1PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor2PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2PositionView.setAdapter(rotor2PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor3PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3PositionView.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> reflectorPositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
reflectorPositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
reflectorPositionView.setAdapter(reflectorPositionAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetLayout() {
|
||||||
|
enigma = new Enigma_G312();
|
||||||
|
setLayoutState(enigma.getState());
|
||||||
|
output.setText("");
|
||||||
|
input.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
this.rotor1View.setSelection(state.getTypeRotor1() - offsetRot);
|
||||||
|
this.rotor2View.setSelection(state.getTypeRotor2() - offsetRot);
|
||||||
|
this.rotor3View.setSelection(state.getTypeRotor3() - offsetRot);
|
||||||
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
this.reflectorPositionView.setSelection(state.getRotationReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshState()
|
||||||
|
{
|
||||||
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + offsetRot);
|
||||||
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationReflector(reflectorPositionView.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRingSettingsDialog()
|
||||||
|
{
|
||||||
|
new RingSettingsDialogBuilder.RingSettingsDialogBuilderRotRotRotRef().
|
||||||
|
createRingSettingsDialog(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import de.vanitasvitae.enigmandroid.R;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.Enigma_K;
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_K;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_K_Swiss_Standard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LayoutContainer for the Enigma Model K
|
* LayoutContainer for the Enigma Model K
|
||||||
|
@ -114,9 +115,9 @@ public class LayoutContainer_K extends LayoutContainer
|
||||||
protected void setLayoutState(EnigmaStateBundle state)
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
{
|
{
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.rotor1View.setSelection(state.getTypeRotor1()-14);
|
this.rotor1View.setSelection(state.getTypeRotor1() - 35);
|
||||||
this.rotor2View.setSelection(state.getTypeRotor2()-14);
|
this.rotor2View.setSelection(state.getTypeRotor2() - 35);
|
||||||
this.rotor3View.setSelection(state.getTypeRotor3()-14);
|
this.rotor3View.setSelection(state.getTypeRotor3() - 35);
|
||||||
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
@ -126,9 +127,9 @@ public class LayoutContainer_K extends LayoutContainer
|
||||||
@Override
|
@Override
|
||||||
protected void refreshState()
|
protected void refreshState()
|
||||||
{
|
{
|
||||||
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + 14);
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + 35);
|
||||||
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + 14);
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + 35);
|
||||||
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + 14);
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + 35);
|
||||||
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.layout;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.R;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_K;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_K_Swiss_Standard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutContainer for the Enigma Model K
|
||||||
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class LayoutContainer_K_Swiss extends LayoutContainer
|
||||||
|
{
|
||||||
|
private Enigma_K_Swiss_Standard enigma;
|
||||||
|
|
||||||
|
protected Spinner rotor1View;
|
||||||
|
protected Spinner rotor2View;
|
||||||
|
protected Spinner rotor3View;
|
||||||
|
|
||||||
|
protected Spinner rotor1PositionView;
|
||||||
|
protected Spinner rotor2PositionView;
|
||||||
|
protected Spinner rotor3PositionView;
|
||||||
|
protected Spinner reflectorPositionView;
|
||||||
|
|
||||||
|
public LayoutContainer_K_Swiss()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
main.setTitle("KS - EnigmAndroid");
|
||||||
|
this.resetLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enigma getEnigma() {
|
||||||
|
return this.enigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeLayout() {
|
||||||
|
this.rotor1View = (Spinner) main.findViewById(R.id.rotor1);
|
||||||
|
this.rotor2View = (Spinner) main.findViewById(R.id.rotor2);
|
||||||
|
this.rotor3View = (Spinner) main.findViewById(R.id.rotor3);
|
||||||
|
this.rotor1PositionView = (Spinner) main.findViewById(R.id.rotor1position);
|
||||||
|
this.rotor2PositionView = (Spinner) main.findViewById(R.id.rotor2position);
|
||||||
|
this.rotor3PositionView = (Spinner) main.findViewById(R.id.rotor3position);
|
||||||
|
this.reflectorPositionView = (Spinner) main.findViewById(R.id.reflector_position);
|
||||||
|
|
||||||
|
Character[] rotorPositionArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {rotorPositionArray[i] = (char) (65+i); /**Fill with A..Z*/}
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1View.setAdapter(rotor1Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2View.setAdapter(rotor2Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3View.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor1PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1PositionView.setAdapter(rotor1PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor2PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2PositionView.setAdapter(rotor2PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor3PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3PositionView.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> reflectorPositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
reflectorPositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
reflectorPositionView.setAdapter(reflectorPositionAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetLayout() {
|
||||||
|
enigma = new Enigma_K_Swiss_Standard();
|
||||||
|
setLayoutState(enigma.getState());
|
||||||
|
output.setText("");
|
||||||
|
input.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
this.rotor1View.setSelection(state.getTypeRotor1() - 14);
|
||||||
|
this.rotor2View.setSelection(state.getTypeRotor2() - 14);
|
||||||
|
this.rotor3View.setSelection(state.getTypeRotor3() - 14);
|
||||||
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
this.reflectorPositionView.setSelection(state.getRotationReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshState()
|
||||||
|
{
|
||||||
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + 14);
|
||||||
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + 14);
|
||||||
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + 14);
|
||||||
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationReflector(reflectorPositionView.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRingSettingsDialog()
|
||||||
|
{
|
||||||
|
new RingSettingsDialogBuilder.RingSettingsDialogBuilderRotRotRotRef().
|
||||||
|
createRingSettingsDialog(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.layout;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.R;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_K;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_K_Swiss_Airforce;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutContainer for the Enigma Model K
|
||||||
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class LayoutContainer_K_Swiss_Airforce extends LayoutContainer
|
||||||
|
{
|
||||||
|
private Enigma_K_Swiss_Airforce enigma;
|
||||||
|
|
||||||
|
protected Spinner rotor1View;
|
||||||
|
protected Spinner rotor2View;
|
||||||
|
protected Spinner rotor3View;
|
||||||
|
|
||||||
|
protected Spinner rotor1PositionView;
|
||||||
|
protected Spinner rotor2PositionView;
|
||||||
|
protected Spinner rotor3PositionView;
|
||||||
|
protected Spinner reflectorPositionView;
|
||||||
|
|
||||||
|
public LayoutContainer_K_Swiss_Airforce()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
main.setTitle("KSA - EnigmAndroid");
|
||||||
|
this.resetLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enigma getEnigma() {
|
||||||
|
return this.enigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeLayout() {
|
||||||
|
this.rotor1View = (Spinner) main.findViewById(R.id.rotor1);
|
||||||
|
this.rotor2View = (Spinner) main.findViewById(R.id.rotor2);
|
||||||
|
this.rotor3View = (Spinner) main.findViewById(R.id.rotor3);
|
||||||
|
this.rotor1PositionView = (Spinner) main.findViewById(R.id.rotor1position);
|
||||||
|
this.rotor2PositionView = (Spinner) main.findViewById(R.id.rotor2position);
|
||||||
|
this.rotor3PositionView = (Spinner) main.findViewById(R.id.rotor3position);
|
||||||
|
this.reflectorPositionView = (Spinner) main.findViewById(R.id.reflector_position);
|
||||||
|
|
||||||
|
Character[] rotorPositionArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {rotorPositionArray[i] = (char) (65+i); /**Fill with A..Z*/}
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1View.setAdapter(rotor1Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2View.setAdapter(rotor2Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3View.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor1PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1PositionView.setAdapter(rotor1PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor2PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2PositionView.setAdapter(rotor2PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor3PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3PositionView.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> reflectorPositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
reflectorPositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
reflectorPositionView.setAdapter(reflectorPositionAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetLayout() {
|
||||||
|
enigma = new Enigma_K_Swiss_Airforce();
|
||||||
|
setLayoutState(enigma.getState());
|
||||||
|
output.setText("");
|
||||||
|
input.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
this.rotor1View.setSelection(state.getTypeRotor1() - 38);
|
||||||
|
this.rotor2View.setSelection(state.getTypeRotor2() - 38);
|
||||||
|
this.rotor3View.setSelection(state.getTypeRotor3() - 38);
|
||||||
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
this.reflectorPositionView.setSelection(state.getRotationReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshState()
|
||||||
|
{
|
||||||
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + 38);
|
||||||
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + 38);
|
||||||
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + 38);
|
||||||
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationReflector(reflectorPositionView.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRingSettingsDialog()
|
||||||
|
{
|
||||||
|
new RingSettingsDialogBuilder.RingSettingsDialogBuilderRotRotRotRef().
|
||||||
|
createRingSettingsDialog(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,144 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.layout;
|
||||||
|
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.R;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutContainer for the Enigma Model R
|
||||||
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
* @author vanitasvitae
|
||||||
|
*/
|
||||||
|
public class LayoutContainer_R extends LayoutContainer
|
||||||
|
{
|
||||||
|
private Enigma_R enigma;
|
||||||
|
|
||||||
|
protected Spinner rotor1View;
|
||||||
|
protected Spinner rotor2View;
|
||||||
|
protected Spinner rotor3View;
|
||||||
|
|
||||||
|
protected Spinner rotor1PositionView;
|
||||||
|
protected Spinner rotor2PositionView;
|
||||||
|
protected Spinner rotor3PositionView;
|
||||||
|
protected Spinner reflectorPositionView;
|
||||||
|
|
||||||
|
public LayoutContainer_R()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
main.setTitle("R - EnigmAndroid");
|
||||||
|
this.resetLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enigma getEnigma() {
|
||||||
|
return this.enigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeLayout() {
|
||||||
|
this.rotor1View = (Spinner) main.findViewById(R.id.rotor1);
|
||||||
|
this.rotor2View = (Spinner) main.findViewById(R.id.rotor2);
|
||||||
|
this.rotor3View = (Spinner) main.findViewById(R.id.rotor3);
|
||||||
|
this.rotor1PositionView = (Spinner) main.findViewById(R.id.rotor1position);
|
||||||
|
this.rotor2PositionView = (Spinner) main.findViewById(R.id.rotor2position);
|
||||||
|
this.rotor3PositionView = (Spinner) main.findViewById(R.id.rotor3position);
|
||||||
|
this.reflectorPositionView = (Spinner) main.findViewById(R.id.reflector_position);
|
||||||
|
|
||||||
|
Character[] rotorPositionArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {rotorPositionArray[i] = (char) (65+i); /**Fill with A..Z*/}
|
||||||
|
|
||||||
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1View.setAdapter(rotor1Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2View.setAdapter(rotor2Adapter);
|
||||||
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(main, R.array.rotors_1_3,
|
||||||
|
android.R.layout.simple_spinner_item);
|
||||||
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3View.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor1PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor1PositionView.setAdapter(rotor1PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor2PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor2PositionView.setAdapter(rotor2PositionAdapter);
|
||||||
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
rotor3PositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
rotor3PositionView.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
|
ArrayAdapter<Character> reflectorPositionAdapter = new ArrayAdapter<>(main.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item, rotorPositionArray);
|
||||||
|
reflectorPositionAdapter.setDropDownViewResource(
|
||||||
|
android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
reflectorPositionView.setAdapter(reflectorPositionAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetLayout() {
|
||||||
|
enigma = new Enigma_R();
|
||||||
|
setLayoutState(enigma.getState());
|
||||||
|
output.setText("");
|
||||||
|
input.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLayoutState(EnigmaStateBundle state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
this.rotor1View.setSelection(state.getTypeRotor1() - 41);
|
||||||
|
this.rotor2View.setSelection(state.getTypeRotor2() - 41);
|
||||||
|
this.rotor3View.setSelection(state.getTypeRotor3() - 41);
|
||||||
|
this.rotor1PositionView.setSelection(state.getRotationRotor1());
|
||||||
|
this.rotor2PositionView.setSelection(state.getRotationRotor2());
|
||||||
|
this.rotor3PositionView.setSelection(state.getRotationRotor3());
|
||||||
|
this.reflectorPositionView.setSelection(state.getRotationReflector());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshState()
|
||||||
|
{
|
||||||
|
state.setTypeRotor1(rotor1View.getSelectedItemPosition() + 41);
|
||||||
|
state.setTypeRotor2(rotor2View.getSelectedItemPosition() + 41);
|
||||||
|
state.setTypeRotor3(rotor3View.getSelectedItemPosition() + 41);
|
||||||
|
state.setRotationRotor1(rotor1PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor2(rotor2PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationRotor3(rotor3PositionView.getSelectedItemPosition());
|
||||||
|
state.setRotationReflector(reflectorPositionView.getSelectedItemPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showRingSettingsDialog()
|
||||||
|
{
|
||||||
|
new RingSettingsDialogBuilder.RingSettingsDialogBuilderRotRotRotRef().
|
||||||
|
createRingSettingsDialog(state);
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ import de.vanitasvitae.enigmandroid.enigma.EnigmaStateBundle;
|
||||||
import de.vanitasvitae.enigmandroid.enigma.Enigma_T;
|
import de.vanitasvitae.enigmandroid.enigma.Enigma_T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LayoutContainer for the Enigma Model K
|
* LayoutContainer for the Enigma Model T
|
||||||
* This class contains the layout and controls the layout elements such as spinners and stuff
|
* This class contains the layout and controls the layout elements such as spinners and stuff
|
||||||
* Copyright (C) 2015 Paul Schaub
|
* Copyright (C) 2015 Paul Schaub
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,36 @@
|
||||||
</Spinner>
|
</Spinner>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/lin_lay_1"
|
||||||
|
android:layout_above="@+id/buttons_lay"
|
||||||
|
android:id="@+id/text_layer">
|
||||||
|
<EditText
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight=".50"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/input"
|
||||||
|
android:inputType="textNoSuggestions|textMultiLine"
|
||||||
|
android:hint="@string/hint_enigma_type_here" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight=".50"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:inputType="none"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:id="@+id/output"
|
||||||
|
android:hint="@string/hint_enigma_code"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/buttons_lay"
|
android:id="@+id/buttons_lay"
|
||||||
android:layout_below="@+id/lin_lay_1"
|
android:layout_alignParentBottom="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -94,28 +118,4 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/buttons_lay"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:id="@+id/text_layer">
|
|
||||||
<EditText
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight=".50"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/input"
|
|
||||||
android:inputType="textNoSuggestions|textMultiLine"
|
|
||||||
android:hint="@string/hint_enigma_type_here" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight=".50"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:inputType="none"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:id="@+id/output"
|
|
||||||
android:hint="@string/hint_enigma_code"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
<string name="description_text">EnigmAndroid ist die Implementation einer Simulation der Enigma Maschine.
|
<string name="description_text">EnigmAndroid ist die Implementation einer Simulation der Enigma Maschine.
|
||||||
Die Enigma Maschine ist eine in den 1920er Jahren entwickelte Verschlüsselungsmaschine,
|
Die Enigma Maschine ist eine in den 1920er Jahren entwickelte Verschlüsselungsmaschine,
|
||||||
die unter anderem im zweiten Weltkrieg von der deutschen Wehrmacht eingesetzt wurde,
|
die unter anderem im zweiten Weltkrieg von der deutschen Wehrmacht eingesetzt wurde,
|
||||||
um geheime Nachrichten zu verschlüsseln. Dabei wird jeder einzelne Buchstabe elektronisch
|
um geheime Nachrichten zu verschlüsseln. Es gab mehrere verschiedene Enigmamodelle.
|
||||||
|
Zur Verschlüsselung wird jeder einzelne Buchstabe elektronisch
|
||||||
durch eine Reihe von rotierbaren Walzen geleitet, sodass nach jedem Buchstaben ein anderes
|
durch eine Reihe von rotierbaren Walzen geleitet, sodass nach jedem Buchstaben ein anderes
|
||||||
Verschlüsselungsalphabet genutzt wird (Polyalphabetische Substitution).
|
Verschlüsselungsalphabet genutzt wird (Polyalphabetische Substitution).
|
||||||
Die Walzen konnte man aus einem Set von 5 Walzen wählen. Zusätzlich gab es ein Steckbrett, an dem
|
Die Walzen konnte man aus einem Set von 5 Walzen wählen. Zusätzlich gab es ein Steckbrett, an dem
|
||||||
|
@ -19,10 +20,10 @@
|
||||||
<string name="section_how_to_use">Um einen Text mit EnigmAndroid zu ver- oder entschlüsseln, wählen Sie zunächst das entsprechende Maschinenmodell aus.
|
<string name="section_how_to_use">Um einen Text mit EnigmAndroid zu ver- oder entschlüsseln, wählen Sie zunächst das entsprechende Maschinenmodell aus.
|
||||||
Sie finden eine Liste, aus der Sie wählen können in den Einstellungen. Tippen Sie dann den Klar- oder Geheimtext in das Feld \"Hier tippen\".
|
Sie finden eine Liste, aus der Sie wählen können in den Einstellungen. Tippen Sie dann den Klar- oder Geheimtext in das Feld \"Hier tippen\".
|
||||||
Wählen Sie anschließend je nach gewähltem Modell eine Umkehrwalze, sowie weitere Walzen aus. Legen Sie außerdem die Startpositionen der Walzen fest.
|
Wählen Sie anschließend je nach gewähltem Modell eine Umkehrwalze, sowie weitere Walzen aus. Legen Sie außerdem die Startpositionen der Walzen fest.
|
||||||
Zuletzt können Sie ggf. noch einige Steckerpaare auf dem Steckbrett festlegen, oder die Verkabelung der Umkehrwalze ändern. Tippen Sie dazu die
|
Zuletzt können Sie ggf. noch einige Steckerpaare auf dem Steckbrett festlegen, oder die Verkabelung der Umkehrwalze ändern. Tippen Sie dazu den
|
||||||
gewünschten Paare mit Komma getrennt in das entsprechende Textfeld (zb. \"ab,cd\").
|
jeweiligen Button an und verbinden Sie die gewünschten Steckerpaare, indem Sie im sich öffnenden Dialog nacheinander jeweils zwei
|
||||||
Beachten Sie, dass Sie einen Stecker nicht doppelt nutzen dürfen.
|
Stecker berühren. Falls sie eine Verbindung trennen möchten, klicken Sie einen der betroffenen Stecker doppelt an.
|
||||||
Optional können Sie auch noch die Ringstellung definieren. Öffnen Sie dazu das Optionsmenü und wählen Sie den Punkt \"Ringstellung\".
|
Optional können Sie außerdem auch noch die Ringstellung definieren. Öffnen Sie dazu das Optionsmenü und wählen Sie den Punkt \"Ringstellung\".
|
||||||
Haben Sie alle Einstellungen getätigt klicken Sie auf den Button \"Ver-Entschlüsseln\".</string>
|
Haben Sie alle Einstellungen getätigt klicken Sie auf den Button \"Ver-Entschlüsseln\".</string>
|
||||||
|
|
||||||
<string name="title_section_developer">Entwickler</string>
|
<string name="title_section_developer">Entwickler</string>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<string name="title_about_dialog">About EnigmAndroid</string>
|
<string name="title_about_dialog">About EnigmAndroid</string>
|
||||||
<string name="description_text">EnigmAndroid is an implementation of a simulation of the Enigma Machine.
|
<string name="description_text">EnigmAndroid is an implementation of a simulation of the Enigma Machine.
|
||||||
The Enigma Machine is a cypher machine developed in the 1920s. It was used by the german Wehrmacht to
|
The Enigma Machine is a cypher machine developed in the 1920s. It was used by the german Wehrmacht to
|
||||||
encipher secret messaged during the second world war. For enciphering text, every letter is passed through 3 mechanical rotors that rotate with every keypress.
|
encipher secret messaged during the second world war. There were multiple different Enigma models. For enciphering text, every letter is passed through 3-4 mechanical rotors that rotate with every keypress.
|
||||||
That way the enigma achieves polyalphabetic substitution and the output appears random. The rotors could be chosen from a set of 5. Additionally there was a
|
That way the enigma achieves polyalphabetic substitution and the output appears random. The rotors could be chosen from a set of 5. Additionally there was a
|
||||||
so called plugboard, where one could switch over pairs of letters.
|
so called plugboard, where one could switch over pairs of letters.
|
||||||
</string>
|
</string>
|
||||||
|
@ -16,9 +16,10 @@
|
||||||
<string name="section_how_to_use">In the beginning, choose a model of the enigma machine to work with.
|
<string name="section_how_to_use">In the beginning, choose a model of the enigma machine to work with.
|
||||||
You can do this in the settings. To encrypt/decrpyt a message, you can type it into the input field.
|
You can do this in the settings. To encrypt/decrpyt a message, you can type it into the input field.
|
||||||
Afterwards you can - depending on the chosen model - select a reflector and the some rotors. Also select their initial positions.
|
Afterwards you can - depending on the chosen model - select a reflector and the some rotors. Also select their initial positions.
|
||||||
Then you may set pairs on the plugboard or on the pluggable reflector. Therefore you just type the pairs separated by commas (e.g. \"ab,cd\").
|
Then you may set pairs on the plugboard or on the pluggable reflector.
|
||||||
Notice that you can\'t plug a letter twice.
|
Therefore press the respective button and connect the characters you wish to connect by clicking them one after another.
|
||||||
Optionally you can set custom ring settings. Open the options menu and select \"Ringsettings\".
|
If you want to disconnect two plugs, just touch one of the plugs twice.
|
||||||
|
Also you can optionally set custom ring settings. Open the options menu and select \"Ringsettings\".
|
||||||
When you are ready press \"En-/Decrypt!\".</string>
|
When you are ready press \"En-/Decrypt!\".</string>
|
||||||
|
|
||||||
<string name="title_section_developer">Developer</string>
|
<string name="title_section_developer">Developer</string>
|
||||||
|
|
|
@ -5,13 +5,34 @@
|
||||||
<string name="pref_title_machine_type">Enigma Model</string>
|
<string name="pref_title_machine_type">Enigma Model</string>
|
||||||
<string name="pref_description_machine_type">Which model do you want to simulate?</string>
|
<string name="pref_description_machine_type">Which model do you want to simulate?</string>
|
||||||
<string-array translatable="false" name="pref_list_machine_type">
|
<string-array translatable="false" name="pref_list_machine_type">
|
||||||
|
<item>I (Heer, Luftwaffe)</item>
|
||||||
|
<item>M3 (Heer, Marine)</item>
|
||||||
|
<item>M4 (\"Shark\", Marine)</item>
|
||||||
|
<item>G31/A865 (Abwehr)</item>
|
||||||
|
<item>G312 (Abwehr)</item>
|
||||||
|
<item>G260 (Abwehr)</item>
|
||||||
|
<item>D (Kommerziell)</item>
|
||||||
|
<item>K</item>
|
||||||
|
<item>K (Swiss)</item>
|
||||||
|
<item>K (Swiss, Airforce)</item>
|
||||||
|
<item>R (\"Rocket\", Reichsbahn)</item>
|
||||||
|
<item>T (\"Tirpitz\", Japan)</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array translatable="false" name="pref_alias_machine_type">
|
||||||
<item>I</item>
|
<item>I</item>
|
||||||
<item>M3</item>
|
<item>M3</item>
|
||||||
<item>M4</item>
|
<item>M4</item>
|
||||||
|
<item>G31</item>
|
||||||
|
<item>G312</item>
|
||||||
|
<item>G260</item>
|
||||||
<item>D</item>
|
<item>D</item>
|
||||||
<item>K</item>
|
<item>K</item>
|
||||||
|
<item>KS</item>
|
||||||
|
<item>KSA</item>
|
||||||
|
<item>R</item>
|
||||||
<item>T</item>
|
<item>T</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string name="pref_title_simulate_anomaly">Simulate Anomaly</string>
|
<string name="pref_title_simulate_anomaly">Simulate Anomaly</string>
|
||||||
<string name="pref_description_simulate_anomaly">The double step anomaly causes the middle rotor
|
<string name="pref_description_simulate_anomaly">The double step anomaly causes the middle rotor
|
||||||
to rotate twice, if it is one step before its turnover point.
|
to rotate twice, if it is one step before its turnover point.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
android:title="@string/pref_title_machine_type"
|
android:title="@string/pref_title_machine_type"
|
||||||
android:summary="@string/pref_description_machine_type"
|
android:summary="@string/pref_description_machine_type"
|
||||||
android:entries="@array/pref_list_machine_type"
|
android:entries="@array/pref_list_machine_type"
|
||||||
android:entryValues="@array/pref_list_machine_type"
|
android:entryValues="@array/pref_alias_machine_type"
|
||||||
android:defaultValue="Enigma I"/>
|
android:defaultValue="Enigma I"/>
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="prefAnomaly"
|
android:key="prefAnomaly"
|
||||||
|
|
Loading…
Reference in a new issue