mirror of
https://github.com/vanitasvitae/EnigmAndroid.git
synced 2024-11-25 22:02:07 +01:00
Finally removed the "bug" with the bad encryption; It was a known anomaly in the historical enigma machine that I oversaw. So I added this "historical bug" as a feature to the enigma. Thanks to the author of the java script version of the enigma machine for the hint :)
This commit is contained in:
parent
2e891d8213
commit
e3ea69fd3c
13 changed files with 873 additions and 630 deletions
|
@ -59,7 +59,7 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 20 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 21
|
||||||
buildToolsVersion "20.0.0"
|
buildToolsVersion "20.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "de.vanitasvitae.enigmandroid"
|
applicationId "de.vanitasvitae.enigmandroid"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 20
|
targetSdkVersion 21
|
||||||
versionCode 5
|
versionCode 6
|
||||||
versionName "17.02.2015-beta"
|
versionName "0.1.1-18.02.2015-beta"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package de.vanitasvitae.enigmandroid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enigma-machine
|
* Enigma-machine
|
||||||
* @author vanitasvitae
|
|
||||||
*
|
*
|
||||||
|
* @author vanitasvitae
|
||||||
*/
|
*/
|
||||||
public class Enigma
|
public class Enigma
|
||||||
{
|
{
|
||||||
|
@ -17,13 +17,14 @@ public class Enigma
|
||||||
//Slot for the reflector
|
//Slot for the reflector
|
||||||
private Rotor reflector;
|
private Rotor reflector;
|
||||||
private boolean anomaly;
|
private boolean anomaly;
|
||||||
//Standard configuration (rotors 1-3, reflector B, all three rotors set to position 1)
|
//Standard configuration (rotors 1-3, reflector B, all three rotors set to position 1, rings too)
|
||||||
private static final int[] STANDARD_CONFIGURATION = {1,2,3,2,1,1,1};
|
public static final int[] STANDARD_CONFIGURATION = {1, 2, 3, 2, 1, 1, 1, 0, 0, 0};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Enigma with given configuration.
|
* Create new Enigma with given configuration.
|
||||||
* If pbconf == null no plugs will be set (no scrambling in the plugboard).
|
* If pbconf == null no plugs will be set (no scrambling in the plugboard).
|
||||||
* If conf == null the enigma will be set to STANDARD_CONFIGURATION.
|
* If conf == null the enigma will be set to STANDARD_CONFIGURATION.
|
||||||
|
*
|
||||||
* @param pbconf two-dimensional array containing the chars symbolizing plugs that need to be switched over.
|
* @param pbconf two-dimensional array containing the chars symbolizing plugs that need to be switched over.
|
||||||
* @param conf configuration of the enigma (a,b,c,d,e,f,g - a-c rotors, d reflector, e-g positions of the rotors)
|
* @param conf configuration of the enigma (a,b,c,d,e,f,g - a-c rotors, d reflector, e-g positions of the rotors)
|
||||||
*/
|
*/
|
||||||
|
@ -37,6 +38,7 @@ public class Enigma
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypt / Decrypt a given String
|
* Encrypt / Decrypt a given String
|
||||||
|
*
|
||||||
* @param w Text to decrypt/encrypt
|
* @param w Text to decrypt/encrypt
|
||||||
* @return encrypted/decrypted string
|
* @return encrypted/decrypted string
|
||||||
*/
|
*/
|
||||||
|
@ -58,6 +60,7 @@ public class Enigma
|
||||||
/**
|
/**
|
||||||
* Perform crypto on char.
|
* Perform crypto on char.
|
||||||
* Beforehand rotate rotors. Also implement the rotor anomaly.
|
* Beforehand rotate rotors. Also implement the rotor anomaly.
|
||||||
|
*
|
||||||
* @param k input char
|
* @param k input char
|
||||||
* @return output char
|
* @return output char
|
||||||
*/
|
*/
|
||||||
|
@ -69,8 +72,7 @@ public class Enigma
|
||||||
{
|
{
|
||||||
r2.incrementCounter();
|
r2.incrementCounter();
|
||||||
//Handle Anomaly
|
//Handle Anomaly
|
||||||
this.anomaly = false;
|
this.anomaly = r2.doubleTurnAnomaly();
|
||||||
if(r2.getCounter() == r2.getTurnOver()-1) this.anomaly=true;
|
|
||||||
if (r2.isAtTurnoverPosition())
|
if (r2.isAtTurnoverPosition())
|
||||||
{
|
{
|
||||||
r3.incrementCounter();
|
r3.incrementCounter();
|
||||||
|
@ -107,6 +109,7 @@ public class Enigma
|
||||||
* Prepare String for encryption via enigma
|
* Prepare String for encryption via enigma
|
||||||
* Replace . , ! ? : with X
|
* Replace . , ! ? : with X
|
||||||
* Remove all other chars that are not A..Z
|
* Remove all other chars that are not A..Z
|
||||||
|
*
|
||||||
* @param word string
|
* @param word string
|
||||||
* @return prepared string
|
* @return prepared string
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +142,7 @@ public class Enigma
|
||||||
* String must be in format XY,AZ and so on.
|
* String must be in format XY,AZ and so on.
|
||||||
* X and Y are plugs, that will be switched over.
|
* X and Y are plugs, that will be switched over.
|
||||||
* Don't use plugs twice such as in AA or AB,CA. This will cause Exceptions.
|
* Don't use plugs twice such as in AA or AB,CA. This will cause Exceptions.
|
||||||
|
*
|
||||||
* @param p String
|
* @param p String
|
||||||
* @return Array containing plugboard configuration
|
* @return Array containing plugboard configuration
|
||||||
*/
|
*/
|
||||||
|
@ -157,8 +161,7 @@ public class Enigma
|
||||||
if (in.length != (p.length() + 1) / 3)
|
if (in.length != (p.length() + 1) / 3)
|
||||||
{
|
{
|
||||||
throw new InvalidPlugboardConfigurationFormatException("Error parsing plugs! Maybe you missed a ','?");
|
throw new InvalidPlugboardConfigurationFormatException("Error parsing plugs! Maybe you missed a ','?");
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
//Create new 2 dimensional array for pairs of plugs
|
//Create new 2 dimensional array for pairs of plugs
|
||||||
char[][] plugs = new char[(p.length() + 1) / 3][2];
|
char[][] plugs = new char[(p.length() + 1) / 3][2];
|
||||||
|
@ -185,6 +188,7 @@ public class Enigma
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the plugboard to a new created object and give it the configuration
|
* Set the plugboard to a new created object and give it the configuration
|
||||||
|
*
|
||||||
* @param c configuration
|
* @param c configuration
|
||||||
* @throws Plugboard.PlugAlreadyUsedException
|
* @throws Plugboard.PlugAlreadyUsedException
|
||||||
*/
|
*/
|
||||||
|
@ -203,16 +207,15 @@ public class Enigma
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set config of the enigma
|
* Set config of the enigma
|
||||||
* TODO: Can't this be done in a more elegant way?
|
*
|
||||||
* @param conf configuration
|
* @param conf configuration
|
||||||
*/
|
*/
|
||||||
public void setConfiguration(int[] conf)
|
public void setConfiguration(int[] conf)
|
||||||
{
|
{
|
||||||
if(conf.length!=7)
|
if (conf.length != 10)
|
||||||
{
|
{
|
||||||
setConfiguration(Enigma.STANDARD_CONFIGURATION);
|
setConfiguration(Enigma.STANDARD_CONFIGURATION);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
int ro1 = conf[0];
|
int ro1 = conf[0];
|
||||||
int ro2 = conf[1];
|
int ro2 = conf[1];
|
||||||
|
@ -221,33 +224,36 @@ public class Enigma
|
||||||
int r1rot = 26 + conf[4] - 1;
|
int r1rot = 26 + conf[4] - 1;
|
||||||
int r2rot = 26 + conf[5] - 1;
|
int r2rot = 26 + conf[5] - 1;
|
||||||
int r3rot = 26 + conf[6] - 1;
|
int r3rot = 26 + conf[6] - 1;
|
||||||
|
int ro1Ring = conf[7];
|
||||||
|
int ro2Ring = conf[8];
|
||||||
|
int ro3Ring = conf[9];
|
||||||
|
|
||||||
//Set first rotor
|
//Set first rotor
|
||||||
switch (ro1)
|
switch (ro1)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
r1 = new Rotor('1',(r1rot)%26,0);
|
r1 = new Rotor('1', (r1rot) % 26, ro1Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
r1 = new Rotor('2',(r1rot)%26,0);
|
r1 = new Rotor('2', (r1rot) % 26, ro1Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
r1 = new Rotor('3',(r1rot)%26,0);
|
r1 = new Rotor('3', (r1rot) % 26, ro1Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
r1 = new Rotor('4',(r1rot)%26,0);
|
r1 = new Rotor('4', (r1rot) % 26, ro1Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
r1 = new Rotor('5',(r1rot)%26,0);
|
r1 = new Rotor('5', (r1rot) % 26, ro1Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,27 +262,27 @@ public class Enigma
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
r2 = new Rotor('1',(r2rot)%26,0);
|
r2 = new Rotor('1', (r2rot) % 26, ro2Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
r2 = new Rotor('2',(r2rot)%26,0);
|
r2 = new Rotor('2', (r2rot) % 26, ro2Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
r2 = new Rotor('3',(r2rot)%26,0);
|
r2 = new Rotor('3', (r2rot) % 26, ro2Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
r2 = new Rotor('4',(r2rot)%26,0);
|
r2 = new Rotor('4', (r2rot) % 26, ro2Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
r2 = new Rotor('5',(r2rot)%26,0);
|
r2 = new Rotor('5', (r2rot) % 26, ro2Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,27 +291,27 @@ public class Enigma
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
r3 = new Rotor('1',(r3rot)%26,0);
|
r3 = new Rotor('1', (r3rot) % 26, ro3Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
r3 = new Rotor('2',(r3rot)%26,0);
|
r3 = new Rotor('2', (r3rot) % 26, ro3Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
r3 = new Rotor('3',(r3rot)%26,0);
|
r3 = new Rotor('3', (r3rot) % 26, ro3Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
r3 = new Rotor('4',(r3rot)%26,0);
|
r3 = new Rotor('4', (r3rot) % 26, ro3Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
r3 = new Rotor('5',(r3rot)%26,0);
|
r3 = new Rotor('5', (r3rot) % 26, ro3Ring);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,11 +339,12 @@ public class Enigma
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configuration, the enigma machine is in right NOW
|
* Return the configuration, the enigma machine is in right NOW
|
||||||
|
*
|
||||||
* @return array containing configuration
|
* @return array containing configuration
|
||||||
*/
|
*/
|
||||||
public int[] getConfiguration()
|
public int[] getConfiguration()
|
||||||
{
|
{
|
||||||
int[] c = new int[7];
|
int[] c = new int[10];
|
||||||
{
|
{
|
||||||
c[0] = r1.getType();
|
c[0] = r1.getType();
|
||||||
c[1] = r2.getType();
|
c[1] = r2.getType();
|
||||||
|
@ -346,6 +353,9 @@ public class Enigma
|
||||||
c[4] = r1.getCounter();
|
c[4] = r1.getCounter();
|
||||||
c[5] = r2.getCounter();
|
c[5] = r2.getCounter();
|
||||||
c[6] = r3.getCounter();
|
c[6] = r3.getCounter();
|
||||||
|
c[7] = r1.getRingsetting();
|
||||||
|
c[8] = r2.getRingsetting();
|
||||||
|
c[9] = r3.getRingsetting();
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package de.vanitasvitae.enigmandroid;
|
package de.vanitasvitae.enigmandroid;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -12,40 +14,44 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class MainActivity extends Activity
|
public class MainActivity extends Activity
|
||||||
{
|
{
|
||||||
private Spinner w1;
|
private Spinner rotor1;
|
||||||
private Spinner w2;
|
private Spinner rotor2;
|
||||||
private Spinner w3;
|
private Spinner rotor3;
|
||||||
private Spinner reversingRotor;
|
private Spinner reversingRotor;
|
||||||
private Spinner w1pos;
|
private Spinner rotor1Position;
|
||||||
private Spinner w2pos;
|
private Spinner rotor2Position;
|
||||||
private Spinner w3pos;
|
private Spinner rotor3Position;
|
||||||
private EditText plugboard;
|
private EditText plugboard;
|
||||||
private EditText input;
|
private EditText input;
|
||||||
private EditText output;
|
private EditText output;
|
||||||
|
|
||||||
private Enigma enigma;
|
private Enigma enigma;
|
||||||
|
//memory for the ringsettings
|
||||||
|
private int[] ringsettings = {0,0,0};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
this.setContentView(R.layout.activity_main);
|
this.setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
this.initLayout();
|
this.initLayout();
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
{
|
||||||
this.getMenuInflater().inflate(R.menu.main, menu);
|
this.getMenuInflater().inflate(R.menu.main, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
/**
|
||||||
// Handle action bar item clicks here. The action bar will
|
* Handle Options menu clicks
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
*/
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
|
{
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_version)
|
if (id == R.id.action_version)
|
||||||
{
|
{
|
||||||
|
@ -56,57 +62,76 @@ public class MainActivity extends Activity
|
||||||
else if (id == R.id.action_reset)
|
else if (id == R.id.action_reset)
|
||||||
{
|
{
|
||||||
this.reset();
|
this.reset();
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.message_reset,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (id == R.id.action_choose_ringstellung)
|
||||||
|
{
|
||||||
|
showRingsettingsDialog();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnigma(View v)
|
/**
|
||||||
|
* Updates the enigma to the chosen rotors and plugboard
|
||||||
|
*
|
||||||
|
* @param v View
|
||||||
|
*/
|
||||||
|
public void updateEnigma(View v)
|
||||||
{
|
{
|
||||||
int[] conf = new int[7];
|
int[] conf = new int[10];
|
||||||
conf[0] = w1.getSelectedItemPosition()+1;
|
conf[0] = rotor1.getSelectedItemPosition() + 1;
|
||||||
conf[1] = w2.getSelectedItemPosition()+1;
|
conf[1] = rotor2.getSelectedItemPosition() + 1;
|
||||||
conf[2] = w3.getSelectedItemPosition()+1;
|
conf[2] = rotor3.getSelectedItemPosition() + 1;
|
||||||
conf[3] = reversingRotor.getSelectedItemPosition() + 1;
|
conf[3] = reversingRotor.getSelectedItemPosition() + 1;
|
||||||
conf[4] = w1pos.getSelectedItemPosition()+1;
|
conf[4] = rotor1Position.getSelectedItemPosition() + 1;
|
||||||
conf[5] = w2pos.getSelectedItemPosition()+1;
|
conf[5] = rotor2Position.getSelectedItemPosition() + 1;
|
||||||
conf[6] = w3pos.getSelectedItemPosition()+1;
|
conf[6] = rotor3Position.getSelectedItemPosition() + 1;
|
||||||
|
conf[7] = ringsettings[0];
|
||||||
|
conf[8] = ringsettings[1];
|
||||||
|
conf[9] = ringsettings[2];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
enigma = new Enigma(null, null);
|
enigma = new Enigma(null, null);
|
||||||
}
|
} catch (Plugboard.PlugAlreadyUsedException e)
|
||||||
catch(Plugboard.PlugAlreadyUsedException e)
|
|
||||||
{
|
{
|
||||||
//There is nothing that could possibly go wrong here.
|
//There is nothing that could possibly go wrong here.
|
||||||
}
|
}
|
||||||
|
|
||||||
char[][] pbconf = null;
|
char[][] plugboardConfiguration = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pbconf = Enigma.parsePlugs(plugboard.getText().toString());
|
plugboardConfiguration = Enigma.parsePlugs(plugboard.getText().toString());
|
||||||
}
|
} catch (Enigma.InvalidPlugboardConfigurationFormatException e)
|
||||||
catch(Enigma.InvalidPlugboardConfigurationFormatException e)
|
|
||||||
{
|
{
|
||||||
String error = this.getResources().getString(R.string.error_parsing_plugs) + ": " + e.getMessage();
|
String error = this.getResources().getString(R.string.error_parsing_plugs) + ": " + e.getMessage();
|
||||||
Toast.makeText(getApplicationContext(), error,
|
Toast.makeText(getApplicationContext(), error,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
enigma.setConfiguration(conf);
|
enigma.setConfiguration(conf);
|
||||||
enigma.setPlugboard(pbconf);
|
enigma.setPlugboard(plugboardConfiguration);
|
||||||
|
|
||||||
}
|
} catch (Plugboard.PlugAlreadyUsedException e)
|
||||||
catch(Plugboard.PlugAlreadyUsedException e)
|
|
||||||
{
|
{
|
||||||
Toast.makeText(this.getApplicationContext(), e.getMessage(),
|
Toast.makeText(this.getApplicationContext(), e.getMessage(),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void crypto(View v)
|
/**
|
||||||
|
* Set the chosen Configuration to the enigma, get the input string from the input textbox and prepare it,
|
||||||
|
* set the input to the prepared text, encrypt the prepared input and set the encrypted string to the
|
||||||
|
* output textbox and update the spinners to their new positions.
|
||||||
|
* @param v View
|
||||||
|
*/
|
||||||
|
public void doCrypto(View v)
|
||||||
{
|
{
|
||||||
setEnigma(null);
|
updateEnigma(null);
|
||||||
String m = input.getText().toString();
|
String m = input.getText().toString();
|
||||||
m = Enigma.prepare(m);
|
m = Enigma.prepare(m);
|
||||||
input.setText(m);
|
input.setText(m);
|
||||||
|
@ -115,64 +140,72 @@ public class MainActivity extends Activity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset all the spinners and textboxes and the ringsettings memory
|
||||||
|
*/
|
||||||
private void reset()
|
private void reset()
|
||||||
{
|
{
|
||||||
w1.setSelection(0);
|
rotor1.setSelection(0);
|
||||||
w2.setSelection(1);
|
rotor2.setSelection(1);
|
||||||
w3.setSelection(2);
|
rotor3.setSelection(2);
|
||||||
reversingRotor.setSelection(1);
|
reversingRotor.setSelection(1);
|
||||||
w1pos.setSelection(0);
|
rotor1Position.setSelection(0);
|
||||||
w2pos.setSelection(0);
|
rotor2Position.setSelection(0);
|
||||||
w3pos.setSelection(0);
|
rotor3Position.setSelection(0);
|
||||||
|
ringsettings = new int[]{0,0,0};
|
||||||
plugboard.setText("");
|
plugboard.setText("");
|
||||||
input.setText("");
|
input.setText("");
|
||||||
output.setText("");
|
output.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the Layout
|
||||||
|
*/
|
||||||
private void initLayout()
|
private void initLayout()
|
||||||
{
|
{
|
||||||
w1 = (Spinner) findViewById(R.id.w1);
|
rotor1 = (Spinner) findViewById(R.id.rotor1);
|
||||||
ArrayAdapter<CharSequence> w1adapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.enigma_walzen, android.R.layout.simple_spinner_item);
|
R.array.enigma_rotors, android.R.layout.simple_spinner_item);
|
||||||
w1adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
w1.setAdapter(w1adapter);
|
rotor1.setAdapter(rotor1Adapter);
|
||||||
|
|
||||||
|
|
||||||
w2 = (Spinner) findViewById(R.id.w2);
|
rotor2 = (Spinner) findViewById(R.id.rotor2);
|
||||||
ArrayAdapter<CharSequence> w2adapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor2Adapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.enigma_walzen, android.R.layout.simple_spinner_item);
|
R.array.enigma_rotors, android.R.layout.simple_spinner_item);
|
||||||
w2adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
w2.setAdapter(w2adapter);
|
rotor2.setAdapter(rotor2Adapter);
|
||||||
|
|
||||||
w3 = (Spinner) findViewById(R.id.w3);
|
rotor3 = (Spinner) findViewById(R.id.rotor3);
|
||||||
ArrayAdapter<CharSequence> w3adapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor3Adapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.enigma_walzen, android.R.layout.simple_spinner_item);
|
R.array.enigma_rotors, android.R.layout.simple_spinner_item);
|
||||||
w3adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
w3.setAdapter(w3adapter);
|
rotor3.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
reversingRotor = (Spinner) findViewById(R.id.ukw);
|
reversingRotor = (Spinner) findViewById(R.id.reflector);
|
||||||
ArrayAdapter<CharSequence> ukwadapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> relfectorAdapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.enigma_ukw, android.R.layout.simple_spinner_item);
|
R.array.enigma_reflectors, android.R.layout.simple_spinner_item);
|
||||||
ukwadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
relfectorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
reversingRotor.setAdapter(ukwadapter);
|
reversingRotor.setAdapter(relfectorAdapter);
|
||||||
|
|
||||||
w1pos = (Spinner) findViewById(R.id.w1pos);
|
rotor1Position = (Spinner) findViewById(R.id.rotor1position);
|
||||||
ArrayAdapter<CharSequence> w1posadapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor1PositionAdapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.positions, android.R.layout.simple_spinner_item);
|
R.array.rotor_positions, android.R.layout.simple_spinner_item);
|
||||||
w1posadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor1PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
w1pos.setAdapter(w1posadapter);
|
rotor1Position.setAdapter(rotor1PositionAdapter);
|
||||||
|
|
||||||
w2pos = (Spinner) findViewById(R.id.w2pos);
|
rotor2Position = (Spinner) findViewById(R.id.rotor2position);
|
||||||
ArrayAdapter<CharSequence> w2posadapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor2PositionAdapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.positions, android.R.layout.simple_spinner_item);
|
R.array.rotor_positions, android.R.layout.simple_spinner_item);
|
||||||
w2posadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor2PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
w2pos.setAdapter(w2posadapter);
|
rotor2Position.setAdapter(rotor2PositionAdapter);
|
||||||
|
|
||||||
w3pos = (Spinner) findViewById(R.id.w3pos);
|
rotor3Position = (Spinner) findViewById(R.id.rotor3position);
|
||||||
ArrayAdapter<CharSequence> w3posadapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor3PositionAdapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.positions, android.R.layout.simple_spinner_item);
|
R.array.rotor_positions, android.R.layout.simple_spinner_item);
|
||||||
w3posadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor3PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
w3pos.setAdapter(w3posadapter);
|
rotor3Position.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
plugboard = (EditText) findViewById(R.id.plugboard);
|
plugboard = (EditText) findViewById(R.id.plugboard);
|
||||||
input = (EditText) findViewById(R.id.input);
|
input = (EditText) findViewById(R.id.input);
|
||||||
|
@ -181,13 +214,67 @@ public class MainActivity extends Activity
|
||||||
input.requestFocus();
|
input.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Spinners to their new Positions
|
||||||
|
* @param c Configuration
|
||||||
|
*/
|
||||||
public void updateSpinner(int[] c)
|
public void updateSpinner(int[] c)
|
||||||
{
|
{
|
||||||
w1.setSelection(c[0]-1);
|
rotor1.setSelection(c[0] - 1);
|
||||||
w2.setSelection(c[1]-1);
|
rotor2.setSelection(c[1] - 1);
|
||||||
w3.setSelection(c[2]-1);
|
rotor3.setSelection(c[2] - 1);
|
||||||
w1pos.setSelection(c[4]);
|
rotor1Position.setSelection(c[4]);
|
||||||
w2pos.setSelection(c[5]);
|
rotor2Position.setSelection(c[5]);
|
||||||
w3pos.setSelection(c[6]);
|
rotor3Position.setSelection(c[6]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the dialog where the user can pick the ringsettings and set them if the user doesnt abort.
|
||||||
|
*/
|
||||||
|
public void showRingsettingsDialog()
|
||||||
|
{
|
||||||
|
View ringsettingsView = View.inflate(this, R.layout.dialog_ringsettings, null);
|
||||||
|
|
||||||
|
final Spinner ring1 = (Spinner) ringsettingsView.findViewById(R.id.rotor1ring);
|
||||||
|
ArrayAdapter<CharSequence> ring1Adapter = ArrayAdapter.createFromResource(this, R.array.ring_positions, android.R.layout.simple_spinner_item);
|
||||||
|
ring1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
ring1.setAdapter(ring1Adapter);
|
||||||
|
ring1.setSelection(ringsettings[0]);
|
||||||
|
|
||||||
|
final Spinner ring2 = (Spinner) ringsettingsView.findViewById(R.id.rotor2ring);
|
||||||
|
ArrayAdapter<CharSequence> ring2Adapter = ArrayAdapter.createFromResource(this, R.array.ring_positions, android.R.layout.simple_spinner_item);
|
||||||
|
ring2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
ring2.setAdapter(ring2Adapter);
|
||||||
|
ring2.setSelection(ringsettings[1]);
|
||||||
|
|
||||||
|
final Spinner ring3 = (Spinner) ringsettingsView.findViewById(R.id.rotor3ring);
|
||||||
|
ArrayAdapter<CharSequence> ring3Adapter = ArrayAdapter.createFromResource(this, R.array.ring_positions, android.R.layout.simple_spinner_item);
|
||||||
|
ring3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
ring3.setAdapter(ring3Adapter);
|
||||||
|
ring3.setSelection(ringsettings[2]);
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(R.string.title_ringsetting);
|
||||||
|
builder.setView(ringsettingsView)
|
||||||
|
.setCancelable(true)
|
||||||
|
.setPositiveButton(R.string.dialog_positiv, new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
public void onClick(DialogInterface dialog, int id)
|
||||||
|
{
|
||||||
|
ringsettings = new int[]{ring1.getSelectedItemPosition(), ring2.getSelectedItemPosition(), ring3.getSelectedItemPosition()};
|
||||||
|
String message = getResources().getString(R.string.dialog_ringsettings_success) + " " + (ringsettings[2]+1) + ", " + (ringsettings[1]+1) + ", " + (ringsettings[0]+1) + ".";
|
||||||
|
Toast.makeText(getApplicationContext(), message,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.dialog_negativ, new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
public void onClick(DialogInterface dialog, int id)
|
||||||
|
{
|
||||||
|
dialog.cancel();
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.dialog_ringsettings_abort,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package de.vanitasvitae.enigmandroid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing the plugboard
|
* Class representing the plugboard
|
||||||
* @author vanitasvitae
|
|
||||||
*
|
*
|
||||||
|
* @author vanitasvitae
|
||||||
*/
|
*/
|
||||||
public class Plugboard
|
public class Plugboard
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ public class Plugboard
|
||||||
int[] pb;
|
int[] pb;
|
||||||
//Standard array to compare pb to.
|
//Standard array to compare pb to.
|
||||||
public static final int[] ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
|
public static final int[] ref = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new plugboard without any plugged pairs. (empty, no scrambling here)
|
* Create new plugboard without any plugged pairs. (empty, no scrambling here)
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +28,7 @@ public class Plugboard
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* En-/decrypt a char following the connections on the plugboard
|
* En-/decrypt a char following the connections on the plugboard
|
||||||
|
*
|
||||||
* @param x char to perform crypto on
|
* @param x char to perform crypto on
|
||||||
* @return en-/decrypted char
|
* @return en-/decrypted char
|
||||||
*/
|
*/
|
||||||
|
@ -43,23 +45,9 @@ public class Plugboard
|
||||||
pb = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
|
pb = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set plugs given by 2 dimensional array
|
|
||||||
* @param p configuration
|
|
||||||
* @throws PlugAlreadyUsedException
|
|
||||||
*/
|
|
||||||
public void setPlugs(char[][] p) throws PlugAlreadyUsedException
|
|
||||||
{
|
|
||||||
for(char[] x : p)
|
|
||||||
{
|
|
||||||
if(x!=null)
|
|
||||||
{
|
|
||||||
this.setPlugPair(x[0], x[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Set a pair of plugs on the plugboard
|
* Set a pair of plugs on the plugboard
|
||||||
|
*
|
||||||
* @param a first Plug
|
* @param a first Plug
|
||||||
* @param b second Plug
|
* @param b second Plug
|
||||||
*/
|
*/
|
||||||
|
@ -76,8 +64,7 @@ public class Plugboard
|
||||||
if (pb[x] != ref[x])
|
if (pb[x] != ref[x])
|
||||||
{
|
{
|
||||||
throw new PlugAlreadyUsedException("Plug " + a + " used twice!");
|
throw new PlugAlreadyUsedException("Plug " + a + " used twice!");
|
||||||
}
|
} else if (pb[y] != ref[y])
|
||||||
else if(pb[y]!=ref[y])
|
|
||||||
{
|
{
|
||||||
throw new PlugAlreadyUsedException("Plug " + b + " used twice!");
|
throw new PlugAlreadyUsedException("Plug " + b + " used twice!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package de.vanitasvitae.enigmandroid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a rotor of the Enigma machine (I-V,A-C)
|
* Class representing a rotor of the Enigma machine (I-V,A-C)
|
||||||
* @author vanitas
|
|
||||||
*
|
*
|
||||||
|
* @author vanitas
|
||||||
*/
|
*/
|
||||||
public class Rotor
|
public class Rotor
|
||||||
{
|
{
|
||||||
|
@ -36,9 +36,9 @@ public class Rotor
|
||||||
public static final Integer[] reflectorB = {24, 17, 20, 7, 16, 18, 11, 3, 15, 23, 13, 6, 14, 10, 12, 8, 4, 1, 5, 25, 2, 22, 21, 9, 0, 19};
|
public static final Integer[] reflectorB = {24, 17, 20, 7, 16, 18, 11, 3, 15, 23, 13, 6, 14, 10, 12, 8, 4, 1, 5, 25, 2, 22, 21, 9, 0, 19};
|
||||||
public static final Integer[] reflectorC = {5, 21, 15, 9, 8, 0, 14, 24, 4, 3, 17, 25, 23, 22, 6, 2, 19, 10, 20, 16, 18, 1, 13, 12, 7, 11};
|
public static final Integer[] reflectorC = {5, 21, 15, 9, 8, 0, 14, 24, 4, 3, 17, 25, 23, 22, 6, 2, 19, 10, 20, 16, 18, 1, 13, 12, 7, 11};
|
||||||
|
|
||||||
//Atributes of the rotor
|
//Attributes of the rotor
|
||||||
private Integer[] rotor; //choose one of rotor1-5
|
private Integer[] rotor; //choose one of rotor1-5
|
||||||
private Integer[] rrotor; //choose one of backwardsRotor1-5
|
private Integer[] backwardsRotor; //choose one of backwardsRotor1-5
|
||||||
private int ringsetting;
|
private int ringsetting;
|
||||||
private int turnOver;
|
private int turnOver;
|
||||||
private int counter;
|
private int counter;
|
||||||
|
@ -47,18 +47,19 @@ public class Rotor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Rotor (1 - 5 = normal rotor, -1 - -3 = reversing rotor)
|
* Create new Rotor (1 - 5 = normal rotor, -1 - -3 = reversing rotor)
|
||||||
|
*
|
||||||
* @param type integer determines type
|
* @param type integer determines type
|
||||||
* @param setting setting (rotation) of the rotor
|
* @param setting setting (rotation) of the rotor
|
||||||
*/
|
*/
|
||||||
public Rotor(char type, int setting, int ring)
|
public Rotor(char type, int setting, int ring)
|
||||||
{
|
{
|
||||||
this.ringsetting = ring%26;
|
this.ringsetting = ring;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case '1':
|
case '1':
|
||||||
{
|
{
|
||||||
this.rotor = rotor1;
|
this.rotor = rotor1;
|
||||||
this.rrotor = backwardsRotor1;
|
this.backwardsRotor = backwardsRotor1;
|
||||||
this.counter = setting;
|
this.counter = setting;
|
||||||
this.name = "I";
|
this.name = "I";
|
||||||
this.turnOver = 17; //"Royal"
|
this.turnOver = 17; //"Royal"
|
||||||
|
@ -68,7 +69,7 @@ public class Rotor
|
||||||
case '2':
|
case '2':
|
||||||
{
|
{
|
||||||
this.rotor = rotor2;
|
this.rotor = rotor2;
|
||||||
this.rrotor = backwardsRotor2;
|
this.backwardsRotor = backwardsRotor2;
|
||||||
this.counter = setting;
|
this.counter = setting;
|
||||||
this.name = "II";
|
this.name = "II";
|
||||||
this.turnOver = 5; //"Flags"
|
this.turnOver = 5; //"Flags"
|
||||||
|
@ -78,7 +79,7 @@ public class Rotor
|
||||||
case '3':
|
case '3':
|
||||||
{
|
{
|
||||||
this.rotor = rotor3;
|
this.rotor = rotor3;
|
||||||
this.rrotor = backwardsRotor3;
|
this.backwardsRotor = backwardsRotor3;
|
||||||
this.counter = setting;
|
this.counter = setting;
|
||||||
this.name = "III";
|
this.name = "III";
|
||||||
this.turnOver = 22; //"Wave"
|
this.turnOver = 22; //"Wave"
|
||||||
|
@ -88,7 +89,7 @@ public class Rotor
|
||||||
case '4':
|
case '4':
|
||||||
{
|
{
|
||||||
this.rotor = rotor4;
|
this.rotor = rotor4;
|
||||||
this.rrotor = backwardsRotor4;
|
this.backwardsRotor = backwardsRotor4;
|
||||||
this.counter = setting;
|
this.counter = setting;
|
||||||
this.name = "IV";
|
this.name = "IV";
|
||||||
this.turnOver = 10; //"Kings"
|
this.turnOver = 10; //"Kings"
|
||||||
|
@ -98,7 +99,7 @@ public class Rotor
|
||||||
case '5':
|
case '5':
|
||||||
{
|
{
|
||||||
this.rotor = rotor5;
|
this.rotor = rotor5;
|
||||||
this.rrotor = backwardsRotor5;
|
this.backwardsRotor = backwardsRotor5;
|
||||||
this.counter = setting;
|
this.counter = setting;
|
||||||
this.name = "V";
|
this.name = "V";
|
||||||
this.turnOver = 0; //"Above"
|
this.turnOver = 0; //"Above"
|
||||||
|
@ -108,7 +109,7 @@ public class Rotor
|
||||||
case 'A':
|
case 'A':
|
||||||
{
|
{
|
||||||
this.rotor = reflectorA;
|
this.rotor = reflectorA;
|
||||||
this.rrotor = null;
|
this.backwardsRotor = null;
|
||||||
this.counter = 0;
|
this.counter = 0;
|
||||||
this.name = "A";
|
this.name = "A";
|
||||||
this.type = 1;
|
this.type = 1;
|
||||||
|
@ -117,7 +118,7 @@ public class Rotor
|
||||||
case 'B':
|
case 'B':
|
||||||
{
|
{
|
||||||
this.rotor = reflectorB;
|
this.rotor = reflectorB;
|
||||||
this.rrotor = null;
|
this.backwardsRotor = null;
|
||||||
this.counter = 0;
|
this.counter = 0;
|
||||||
this.name = "B";
|
this.name = "B";
|
||||||
this.type = 2;
|
this.type = 2;
|
||||||
|
@ -126,7 +127,7 @@ public class Rotor
|
||||||
case 'C':
|
case 'C':
|
||||||
{
|
{
|
||||||
this.rotor = reflectorC;
|
this.rotor = reflectorC;
|
||||||
this.rrotor = null;
|
this.backwardsRotor = null;
|
||||||
this.counter = 0;
|
this.counter = 0;
|
||||||
this.name = "C";
|
this.name = "C";
|
||||||
this.type = 3;
|
this.type = 3;
|
||||||
|
@ -137,31 +138,35 @@ public class Rotor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* encrypt in forward direction (forward means first half of the cycle through the rotors)
|
* encrypt in forward direction (forward means first half of the cycle through the rotors)
|
||||||
|
*
|
||||||
* @param x incoming character
|
* @param x incoming character
|
||||||
* @return encrypted character
|
* @return encrypted character
|
||||||
*/
|
*/
|
||||||
public int encryptForward(int x)
|
public int encryptForward(int x)
|
||||||
{
|
{
|
||||||
return this.rotor[(26+x+ringsetting)%26];
|
return this.rotor[(26 + x) % 26];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**encrypt in backward direction (coming from the reversing rotor)
|
/**
|
||||||
|
* encrypt in backward direction (coming from the reversing rotor)
|
||||||
|
*
|
||||||
* @param x incoming character
|
* @param x incoming character
|
||||||
* @return encrypted character
|
* @return encrypted character
|
||||||
*/
|
*/
|
||||||
public int encryptBackward(int x)
|
public int encryptBackward(int x)
|
||||||
{
|
{
|
||||||
if(this.rrotor == null) return this.rotor[(26+x+ringsetting)%26];
|
if (this.backwardsRotor == null) return this.rotor[(26 + x) % 26];
|
||||||
else return this.rrotor[(26+x)%26];
|
else return this.backwardsRotor[(26 + x) % 26];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return rotation of the rotor
|
* return rotation of the rotor - the ringsetting
|
||||||
|
*
|
||||||
* @return rotation
|
* @return rotation
|
||||||
*/
|
*/
|
||||||
public int getCounter()
|
public int getCounter()
|
||||||
{
|
{
|
||||||
return this.counter;
|
return this.counter - this.getRingsetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,18 +179,38 @@ public class Rotor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true, if rotor is at a position, where it turns over the next rotor
|
* Return true, if rotor is at a position, where it turns over the next rotor
|
||||||
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isAtTurnoverPosition()
|
public boolean isAtTurnoverPosition()
|
||||||
{
|
{
|
||||||
return this.getCounter() == this.turnOver;
|
return this.counter == this.turnOver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Double Turn Anomaly (deutsch: Doppelsprung Anomalie) is aa anomaly in the rotor movement caused by the mechanical implementation of the enigma.
|
||||||
|
* Whenever the rightmost rotor turns the middle rotor AND the middle rotor is only one move from turning the leftmost rotor, the middle rotor turns again with the next character.
|
||||||
|
* So technically there are only 26*25*26 possible rotor settings for any but firmly 3 rotors.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean doubleTurnAnomaly()
|
||||||
|
{
|
||||||
|
return this.counter == this.turnOver - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
/**
|
||||||
|
* Returns the position of the turnover notch
|
||||||
|
*
|
||||||
|
* @return turnOver
|
||||||
|
*/
|
||||||
public int getTurnOver()
|
public int getTurnOver()
|
||||||
{
|
{
|
||||||
return this.turnOver;
|
return this.turnOver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
/**
|
/**
|
||||||
* Return the name of the rotor
|
* Return the name of the rotor
|
||||||
* @return name
|
* @return name
|
||||||
|
@ -195,6 +220,7 @@ public class Rotor
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
/**
|
/**
|
||||||
* Return ringsettings of the rotor
|
* Return ringsettings of the rotor
|
||||||
* @return ringsetting
|
* @return ringsetting
|
||||||
|
@ -206,6 +232,7 @@ public class Rotor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the integer, which was used to create this rotor.
|
* Returns the integer, which was used to create this rotor.
|
||||||
|
*
|
||||||
* @return the type of the rotor
|
* @return the type of the rotor
|
||||||
*/
|
*/
|
||||||
public int getType()
|
public int getType()
|
||||||
|
|
|
@ -18,43 +18,43 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_ukw"/>
|
android:text="@string/hint_reflector"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w3"/>
|
android:text="@string/hint_rotor3"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w2"/>
|
android:text="@string/hint_rotor2"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w1"/>
|
android:text="@string/hint_rotor1"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w3pos"/>
|
android:text="@string/hint_rotor3_position"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w2pos"/>
|
android:text="@string/hint_rotor2_position"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w1pos"/>
|
android:text="@string/hint_rotor1_position"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -68,49 +68,49 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/ukw">
|
android:id="@+id/reflector">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w3">
|
android:id="@+id/rotor3">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w2">
|
android:id="@+id/rotor2">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w1">
|
android:id="@+id/rotor1">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w3pos">
|
android:id="@+id/rotor3position">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w2pos">
|
android:id="@+id/rotor2position">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".14"
|
android:layout_weight=".14"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w1pos">
|
android:id="@+id/rotor1position">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/text_layer"
|
android:layout_below="@+id/text_layer"
|
||||||
android:id="@+id/button_crypt"
|
android:id="@+id/button_crypt"
|
||||||
android:onClick="crypto"
|
android:onClick="doCrypto"
|
||||||
android:text="@string/button_crypt"/>
|
android:text="@string/button_crypt"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
android:layout_weight=".50"
|
android:layout_weight=".50"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/input"
|
android:id="@+id/input"
|
||||||
android:hint="@string/hint_enigma_usertype" />
|
android:hint="@string/hint_enigma_type_here" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -18,25 +18,25 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_ukw"/>
|
android:text="@string/hint_reflector"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w3"/>
|
android:text="@string/hint_rotor3"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w2"/>
|
android:text="@string/hint_rotor2"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w1"/>
|
android:text="@string/hint_rotor1"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -49,25 +49,25 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/ukw">
|
android:id="@+id/reflector">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w3">
|
android:id="@+id/rotor3">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w2">
|
android:id="@+id/rotor2">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w1">
|
android:id="@+id/rotor1">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -86,19 +86,19 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w3pos"/>
|
android:text="@string/hint_rotor3_position"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w2pos"/>
|
android:text="@string/hint_rotor2_position"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hint_w1pos"/>
|
android:text="@string/hint_rotor1_position"/>
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".125"
|
android:layout_weight=".125"
|
||||||
|
@ -120,19 +120,19 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w3pos">
|
android:id="@+id/rotor3position">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w2pos">
|
android:id="@+id/rotor2position">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
<Spinner
|
<Spinner
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/w1pos">
|
android:id="@+id/rotor1position">
|
||||||
</Spinner>
|
</Spinner>
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
android:layout_weight=".50"
|
android:layout_weight=".50"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/input"
|
android:id="@+id/input"
|
||||||
android:hint="@string/hint_enigma_usertype" />
|
android:hint="@string/hint_enigma_type_here" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/text_layer"
|
android:layout_below="@+id/text_layer"
|
||||||
android:id="@+id/button_crypt"
|
android:id="@+id/button_crypt"
|
||||||
android:onClick="crypto"
|
android:onClick="doCrypto"
|
||||||
android:text="@string/button_crypt"/>
|
android:text="@string/button_crypt"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
55
app/src/main/res/layout/dialog_ringsettings.xml
Normal file
55
app/src/main/res/layout/dialog_ringsettings.xml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/ringstellung_layout_hint">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="33"
|
||||||
|
android:text="@string/hint_rotor3"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="33"
|
||||||
|
android:text="@string/hint_rotor2"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="33"
|
||||||
|
android:text="@string/hint_rotor1"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/ringstellung_layout_hint"
|
||||||
|
android:id="@+id/ringstellung_layout">
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight=".33"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/rotor3ring">
|
||||||
|
</Spinner>
|
||||||
|
<Spinner
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight=".33"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/rotor2ring">
|
||||||
|
</Spinner>
|
||||||
|
<Spinner
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight=".33"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/rotor1ring">
|
||||||
|
</Spinner>
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
|
@ -7,7 +7,11 @@
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:showAsAction="never" />
|
android:showAsAction="never" />
|
||||||
<item android:id="@+id/action_reset"
|
<item android:id="@+id/action_reset"
|
||||||
android:orderInCategory="99"
|
android:orderInCategory="98"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/action_reset" />
|
android:title="@string/action_reset" />
|
||||||
|
<item android:id="@+id/action_choose_ringstellung"
|
||||||
|
android:title="@string/action_choose_ringsettings"
|
||||||
|
android:orderInCategory="99"
|
||||||
|
android:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -5,34 +5,42 @@
|
||||||
<string name="action_version">Version</string>
|
<string name="action_version">Version</string>
|
||||||
<string name="action_reset">Zurücksetzen</string>
|
<string name="action_reset">Zurücksetzen</string>
|
||||||
<string name="action_settings">Version</string>
|
<string name="action_settings">Version</string>
|
||||||
<string name="hint_enigma_usertype">Hier Tippen</string>
|
<string name="action_choose_ringsettings">Ringstellung</string>
|
||||||
|
<string name="message_choose_ringsettings">Wähle die Ringstellungen für die Walzen:</string>
|
||||||
|
<string name="hint_enigma_type_here">Hier Tippen</string>
|
||||||
<string name="hint_enigma_code">Enigma-Code</string>
|
<string name="hint_enigma_code">Enigma-Code</string>
|
||||||
<string name="hint_enigma_plugboard">Steckerbrett (AZ,BE...)</string>
|
<string name="hint_enigma_plugboard">Steckerbrett (AZ,BE...)</string>
|
||||||
<string name="hint_w1">Walze 1</string>
|
<string name="hint_rotor1">Walze 1</string>
|
||||||
<string name="hint_w2">Walze 2</string>
|
<string name="hint_rotor2">Walze 2</string>
|
||||||
<string name="hint_w3">Walze 3</string>
|
<string name="hint_rotor3">Walze 3</string>
|
||||||
<string name="hint_ukw">Umkehr-\nWalze</string>
|
<string name="hint_reflector">Umkehr-\nWalze</string>
|
||||||
<string name="hint_w1pos">Position\nWalze 1</string>
|
<string name="hint_rotor1_position">Position\nWalze 1</string>
|
||||||
<string name="hint_w2pos">Position\nWalze 2</string>
|
<string name="hint_rotor2_position">Position\nWalze 2</string>
|
||||||
<string name="hint_w3pos">Position\nWalze 3</string>
|
<string name="hint_rotor3_position">Position\nWalze 3</string>
|
||||||
<string name="button_crypt">Ver-/Entschlüsseln</string>
|
<string name="button_crypt">Ver-/Entschlüsseln</string>
|
||||||
<string name="error_parsing_plugs">Fehler: Fehlerhafte Steckerbrettkonfiguration.</string>
|
<string name="error_parsing_plugs">Fehler: Fehlerhafte Steckerbrettkonfiguration.</string>
|
||||||
<string name="error_unable_to_plug_a_b">Kann Stecker nicht setzen: </string>
|
<string name="error_unable_to_plug_a_b">Kann Stecker nicht setzen: </string>
|
||||||
<string name="error_plug_already_in_use">Fehler: Einer oder mehrere dieser Stecker sind bereits in Benutzung: </string>
|
<string name="error_plug_already_in_use">Fehler: Einer oder mehrere dieser Stecker sind bereits in Benutzung: </string>
|
||||||
|
<string name="title_ringsetting">Ringstellungen</string>
|
||||||
|
<string name="dialog_positiv">OK</string>
|
||||||
|
<string name="dialog_negativ">Abbrechen</string>
|
||||||
|
<string name="dialog_ringsettings_success">Setze Ringe auf</string>
|
||||||
|
<string name="dialog_ringsettings_abort">Keine Änderungen</string>
|
||||||
|
<string name="message_reset">Enigma zurückgesetzt</string>
|
||||||
|
|
||||||
<string-array name="enigma_walzen">
|
<string-array name="enigma_rotors">
|
||||||
<item>I</item>
|
<item>I</item>
|
||||||
<item>II</item>
|
<item>II</item>
|
||||||
<item>III</item>
|
<item>III</item>
|
||||||
<item>IV</item>
|
<item>IV</item>
|
||||||
<item>V</item>
|
<item>V</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="enigma_ukw">
|
<string-array name="enigma_reflectors">
|
||||||
<item>A</item>
|
<item>A</item>
|
||||||
<item>B</item>
|
<item>B</item>
|
||||||
<item>C</item>
|
<item>C</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="positions">
|
<string-array name="rotor_positions">
|
||||||
<item>A</item>
|
<item>A</item>
|
||||||
<item>B</item>
|
<item>B</item>
|
||||||
<item>C</item>
|
<item>C</item>
|
||||||
|
@ -60,4 +68,33 @@
|
||||||
<item>Y</item>
|
<item>Y</item>
|
||||||
<item>Z</item>
|
<item>Z</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="ring_positions">
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>8</item>
|
||||||
|
<item>9</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>11</item>
|
||||||
|
<item>12</item>
|
||||||
|
<item>13</item>
|
||||||
|
<item>14</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>16</item>
|
||||||
|
<item>17</item>
|
||||||
|
<item>18</item>
|
||||||
|
<item>19</item>
|
||||||
|
<item>20</item>
|
||||||
|
<item>21</item>
|
||||||
|
<item>22</item>
|
||||||
|
<item>23</item>
|
||||||
|
<item>24</item>
|
||||||
|
<item>25</item>
|
||||||
|
<item>26</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,38 +1,46 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="version" translatable="false">0.1-17.02.2015</string>
|
<string name="version" translatable="false">0.1.1-18.02.2015</string>
|
||||||
<string name="app_name">EnigmAndroid</string>
|
<string name="app_name">EnigmAndroid</string>
|
||||||
<string name="action_version">Version</string>
|
<string name="action_version">Version</string>
|
||||||
<string name="action_reset">Reset</string>
|
<string name="action_reset">Reset</string>
|
||||||
<string name="hint_enigma_usertype">Type here</string>
|
<string name="action_choose_ringsettings">Ringsettings</string>
|
||||||
|
<string name="message_choose_ringsettings">Choose ringsettings for the rotors:</string>
|
||||||
|
<string name="hint_enigma_type_here">Type here</string>
|
||||||
<string name="hint_enigma_code">EnigmaCode</string>
|
<string name="hint_enigma_code">EnigmaCode</string>
|
||||||
<string name="hint_enigma_plugboard">Plugboard (AZ,BE...)</string>
|
<string name="hint_enigma_plugboard">Plugboard (AZ,BE...)</string>
|
||||||
<string name="hint_w1">R1</string>
|
<string name="hint_rotor1">Rotor 1</string>
|
||||||
<string name="hint_w2">R2</string>
|
<string name="hint_rotor2">Rotor 2</string>
|
||||||
<string name="hint_w3">R3</string>
|
<string name="hint_rotor3">Rotor 3</string>
|
||||||
<string name="hint_ukw">RR</string>
|
<string name="hint_reflector">Reflector</string>
|
||||||
<string name="hint_w1pos">PosR1</string>
|
<string name="hint_rotor1_position">Position Rotor 1</string>
|
||||||
<string name="hint_w2pos">PosR2</string>
|
<string name="hint_rotor2_position">Position Rotor 2</string>
|
||||||
<string name="hint_w3pos">PosR3</string>
|
<string name="hint_rotor3_position">Position Rotor 3</string>
|
||||||
<string name="button_crypt">En-/Decrypt!</string>
|
<string name="button_crypt">En-/Decrypt!</string>
|
||||||
<string name="error_parsing_plugs">Error: Can\'t interpret Plugboard Input.</string>
|
<string name="error_parsing_plugs">Error: Can\'t interpret Plugboard Input.</string>
|
||||||
<string name="error_unable_to_plug_a_b">Unable to plug </string>
|
<string name="error_unable_to_plug_a_b">Unable to plug </string>
|
||||||
<string name="error_plug_already_in_use">Error: One or more of these Plugs are already in use: </string>
|
<string name="error_plug_already_in_use">Error: One or more of these Plugs are already in use: </string>
|
||||||
|
<string name="title_ringsetting">Ringsettings</string>
|
||||||
|
<string name="dialog_positiv">OK</string>
|
||||||
|
<string name="dialog_negativ">Cancel</string>
|
||||||
|
<string name="dialog_ringsettings_success">Set Ringsettings to</string>
|
||||||
|
<string name="dialog_ringsettings_abort">No changes</string>
|
||||||
|
<string name="message_reset">Enigma reset</string>
|
||||||
|
|
||||||
<string-array name="enigma_walzen">
|
<string-array name="enigma_rotors">
|
||||||
<item>I</item>
|
<item>I</item>
|
||||||
<item>II</item>
|
<item>II</item>
|
||||||
<item>III</item>
|
<item>III</item>
|
||||||
<item>IV</item>
|
<item>IV</item>
|
||||||
<item>V</item>
|
<item>V</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="enigma_ukw">
|
<string-array name="enigma_reflectors">
|
||||||
<item>A</item>
|
<item>A</item>
|
||||||
<item>B</item>
|
<item>B</item>
|
||||||
<item>C</item>
|
<item>C</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="positions">
|
<string-array name="rotor_positions">
|
||||||
<item>A</item>
|
<item>A</item>
|
||||||
<item>B</item>
|
<item>B</item>
|
||||||
<item>C</item>
|
<item>C</item>
|
||||||
|
@ -60,4 +68,32 @@
|
||||||
<item>Y</item>
|
<item>Y</item>
|
||||||
<item>Z</item>
|
<item>Z</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="ring_positions">
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
|
<item>7</item>
|
||||||
|
<item>8</item>
|
||||||
|
<item>9</item>
|
||||||
|
<item>10</item>
|
||||||
|
<item>11</item>
|
||||||
|
<item>12</item>
|
||||||
|
<item>13</item>
|
||||||
|
<item>14</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>16</item>
|
||||||
|
<item>17</item>
|
||||||
|
<item>18</item>
|
||||||
|
<item>19</item>
|
||||||
|
<item>20</item>
|
||||||
|
<item>21</item>
|
||||||
|
<item>22</item>
|
||||||
|
<item>23</item>
|
||||||
|
<item>24</item>
|
||||||
|
<item>25</item>
|
||||||
|
<item>26</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue