Updated to Version 0.1.4-15.08.2015 Rewrote major parts of the core, fixed layout issues, fixed anomaly, added send/receive functionality
|
@ -1,11 +1,11 @@
|
||||||
<component name="libraryTable">
|
<component name="libraryTable">
|
||||||
<library name="support-annotations-21.0.3">
|
<library name="support-annotations-21.0.3">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar:///media/Daten/android-sdk-linux/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3.jar!/" />
|
<root url="jar:///media/Daten/AndroidSDK/android-sdk-linux/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar:///media/Daten/android-sdk-linux/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3-sources.jar!/" />
|
<root url="jar:///media/Daten/AndroidSDK/android-sdk-linux/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
|
@ -7,7 +7,7 @@
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar:///media/Daten/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3-sources.jar!/" />
|
<root url="jar:///media/Daten/AndroidSDK/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
7
CHANGELOG.txt
Normal file → Executable file
|
@ -1,5 +1,12 @@
|
||||||
CHANGELOG ENIGMANDROID
|
CHANGELOG ENIGMANDROID
|
||||||
|
|
||||||
|
v0.1.4-15.08.2015<
|
||||||
|
*Rewrite of the core implementation to follow some principals of Software Engineering
|
||||||
|
*Fixed some layout issues
|
||||||
|
*Fixed anomaly for step by step inputs
|
||||||
|
*Added send/receive text functionality
|
||||||
|
|
||||||
|
|
||||||
v0.1.3-14.03.2015<
|
v0.1.3-14.03.2015<
|
||||||
*Added About Dialog with ChangeLog-Button
|
*Added About Dialog with ChangeLog-Button
|
||||||
*Moved Version Info into About Dialog
|
*Moved Version Info into About Dialog
|
||||||
|
|
8
EnigmAndroid.iml
Normal file → Executable file
|
@ -1,13 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id="EnigmAndroid" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="java-gradle" name="Java-Gradle">
|
<facet type="java-gradle" name="Java-Gradle">
|
||||||
<configuration>
|
<configuration>
|
||||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||||
|
<option name="BUILDABLE" value="false" />
|
||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||||
|
@ -15,5 +16,4 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
0
License.md
Normal file → Executable file
0
README.md
Normal file → Executable file
25
app/app.iml
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EnigmAndroid" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="EnigmAndroid" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="android-gradle" name="Android-Gradle">
|
<facet type="android-gradle" name="Android-Gradle">
|
||||||
<configuration>
|
<configuration>
|
||||||
|
@ -13,8 +13,11 @@
|
||||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
|
<afterSyncTasks>
|
||||||
|
<task>generateDebugAndroidTestSources</task>
|
||||||
|
<task>generateDebugSources</task>
|
||||||
|
</afterSyncTasks>
|
||||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||||
|
@ -23,7 +26,7 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
|
@ -33,13 +36,13 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||||
|
@ -68,6 +71,7 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||||
|
@ -83,10 +87,9 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 22 Platform (1)" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
330
app/src/main/java/de/vanitasvitae/enigmandroid/Enigma.java
Normal file → Executable file
|
@ -1,6 +1,9 @@
|
||||||
package de.vanitasvitae.enigmandroid;
|
package de.vanitasvitae.enigmandroid;
|
||||||
|
|
||||||
|
|
||||||
|
import de.vanitasvitae.enigmandroid.rotors.Reflector;
|
||||||
|
import de.vanitasvitae.enigmandroid.rotors.Rotor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enigma-machine
|
* Enigma-machine
|
||||||
*Copyright (C) 2015 Paul Schaub
|
*Copyright (C) 2015 Paul Schaub
|
||||||
|
@ -28,27 +31,31 @@ public class Enigma
|
||||||
private Rotor r1;
|
private Rotor r1;
|
||||||
private Rotor r2;
|
private Rotor r2;
|
||||||
private Rotor r3;
|
private Rotor r3;
|
||||||
|
|
||||||
//Slot for the reflector
|
//Slot for the reflector
|
||||||
private Rotor reflector;
|
private Reflector reflector;
|
||||||
|
|
||||||
|
private boolean doAnomaly = false;
|
||||||
|
|
||||||
private boolean prefAnomaly; //Do you want to simulate the anomaly?
|
private boolean prefAnomaly; //Do you want to simulate the anomaly?
|
||||||
private boolean anomaly; //Is it time to spin twice?
|
|
||||||
//Standard configuration (rotors 1-3, reflector B, all three rotors set to position 1, rings too)
|
|
||||||
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 standard configuration.
|
||||||
* If pbconf == null no plugs will be set (no scrambling in the plugboard).
|
* Empty Plugboard, rotors I,II,III, Positions 0,0,0
|
||||||
* 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 conf configuration of the enigma (a,b,c,d,e,f,g - a-c rotors, d reflector, e-g positions of the rotors)
|
|
||||||
*/
|
*/
|
||||||
public Enigma(char[][] pbconf, int[] conf) throws Plugboard.PlugAlreadyUsedException
|
public Enigma()
|
||||||
{
|
{
|
||||||
if (conf != null) setConfiguration(conf);
|
initialize();
|
||||||
else setConfiguration(Enigma.STANDARD_CONFIGURATION);
|
}
|
||||||
|
|
||||||
this.setPlugboard(pbconf);
|
private void initialize()
|
||||||
|
{
|
||||||
|
this.r1 = Rotor.createRotorI(0, 0);
|
||||||
|
this.r2 = Rotor.createRotorII(0, 0);
|
||||||
|
this.r3 = Rotor.createRotorIII(0, 0);
|
||||||
|
this.reflector = Reflector.createReflectorB();
|
||||||
|
plugboard = new Plugboard();
|
||||||
|
prefAnomaly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,16 +67,14 @@ public class Enigma
|
||||||
public String encrypt(String w)
|
public String encrypt(String w)
|
||||||
{
|
{
|
||||||
//output string
|
//output string
|
||||||
String c = "";
|
String output = "";
|
||||||
//for each char x in k
|
//for each char x in k
|
||||||
for (int i = 0; i < w.length(); i++)
|
for (char x : w.toCharArray())
|
||||||
{
|
{
|
||||||
char x = w.charAt(i);
|
output = output + this.encryptChar(x);
|
||||||
//encrypt char
|
|
||||||
c = c + this.encryptChar(x);
|
|
||||||
}
|
}
|
||||||
//return en-/decrypted string
|
//return en-/decrypted string
|
||||||
return c;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,15 +87,15 @@ public class Enigma
|
||||||
public char encryptChar(char k)
|
public char encryptChar(char k)
|
||||||
{
|
{
|
||||||
//Rotate rotors
|
//Rotate rotors
|
||||||
r1.incrementCounter();
|
r1.rotate();
|
||||||
if (r1.isAtTurnoverPosition() || (this.anomaly && prefAnomaly))
|
if (r1.isAtTurnoverPosition() || (this.doAnomaly && prefAnomaly))
|
||||||
{
|
{
|
||||||
r2.incrementCounter();
|
r2.rotate();
|
||||||
//Handle Anomaly
|
//Handle Anomaly
|
||||||
this.anomaly = r2.doubleTurnAnomaly();
|
this.doAnomaly = r2.doubleTurnAnomaly();
|
||||||
if (r2.isAtTurnoverPosition())
|
if (r2.isAtTurnoverPosition())
|
||||||
{
|
{
|
||||||
r3.incrementCounter();
|
r3.rotate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int x = (int) k;
|
int x = (int) k;
|
||||||
|
@ -99,27 +104,32 @@ public class Enigma
|
||||||
//Encryption
|
//Encryption
|
||||||
//forward direction
|
//forward direction
|
||||||
x = plugboard.encrypt(x);
|
x = plugboard.encrypt(x);
|
||||||
x = (x + r1.getCounter()) % 26;
|
x = normalize(x + r1.getRotation());
|
||||||
x = r1.encryptForward(x);
|
x = r1.encryptForward(x);
|
||||||
x = (x + r2.getCounter() - r1.getCounter()) % 26;
|
x = normalize(x + r2.getRotation() - r1.getRotation());
|
||||||
x = r2.encryptForward(x);
|
x = r2.encryptForward(x);
|
||||||
x = (x + r3.getCounter() - r2.getCounter()) % 26;
|
x = normalize(x + r3.getRotation() - r2.getRotation());
|
||||||
x = r3.encryptForward(x);
|
x = r3.encryptForward(x);
|
||||||
x = (26 + x - r3.getCounter()) % 26;
|
x = normalize(x - r3.getRotation());
|
||||||
//backward direction
|
//backward direction
|
||||||
x = reflector.encryptForward(x);
|
x = reflector.encrypt(x);
|
||||||
x = (26 + x + r3.getCounter()) % 26;
|
x = normalize(x + r3.getRotation());
|
||||||
x = r3.encryptBackward(x);
|
x = r3.encryptBackward(x);
|
||||||
x = (26 + x - r3.getCounter() + r2.getCounter()) % 26;
|
x = normalize(x - r3.getRotation() + r2.getRotation());
|
||||||
x = r2.encryptBackward(x);
|
x = r2.encryptBackward(x);
|
||||||
x = (26 + x - r2.getCounter() + r1.getCounter()) % 26;
|
x = normalize(x - r2.getRotation() + r1.getRotation());
|
||||||
x = r1.encryptBackward(x);
|
x = r1.encryptBackward(x);
|
||||||
x = (26 + x - r1.getCounter()) % 26;
|
x = normalize(x - r1.getRotation());
|
||||||
x = plugboard.encrypt(x);
|
x = plugboard.encrypt(x);
|
||||||
|
|
||||||
return (char) (x + 65); //Add Offset
|
return (char) (x + 65); //Add Offset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int normalize(int input)
|
||||||
|
{
|
||||||
|
return (26+input)%26;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare String for encryption via enigma
|
* Prepare String for encryption via enigma
|
||||||
* Replace . , ! ? : with X
|
* Replace . , ! ? : with X
|
||||||
|
@ -130,14 +140,13 @@ public class Enigma
|
||||||
*/
|
*/
|
||||||
public static String prepare(String word)
|
public static String prepare(String word)
|
||||||
{
|
{
|
||||||
String w = word.toUpperCase();
|
String input = word.toUpperCase();
|
||||||
String c = "";
|
String output = "";
|
||||||
for (int i = 0; i < w.length(); i++)
|
for (char x : input.toCharArray())
|
||||||
{
|
{
|
||||||
char x = w.charAt(i);
|
|
||||||
if (x >= 65 && x <= 90) //If x in [A..Z]
|
if (x >= 65 && x <= 90) //If x in [A..Z]
|
||||||
{
|
{
|
||||||
c = c + x; //Append to String
|
output = output + x; //Append to String
|
||||||
}
|
}
|
||||||
//if x is special symbol
|
//if x is special symbol
|
||||||
else
|
else
|
||||||
|
@ -145,86 +154,11 @@ public class Enigma
|
||||||
if (x == '.' || x == ',' || x == '!' || x == '?' || x == ':')
|
if (x == '.' || x == ',' || x == '!' || x == '?' || x == ':')
|
||||||
{
|
{
|
||||||
//replace x with X and encrypt
|
//replace x with X and encrypt
|
||||||
c = c + 'X';
|
output = output + 'X';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return output;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Plugboard configuration from String.
|
|
||||||
* String must be in format XY,AZ and so on.
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @param p String
|
|
||||||
* @return Array containing plugboard configuration
|
|
||||||
*/
|
|
||||||
public static char[][] parsePlugs(String p) throws InvalidPlugboardConfigurationFormatException
|
|
||||||
{
|
|
||||||
p = p.toUpperCase();
|
|
||||||
//Check, if empty
|
|
||||||
if (p.length() == 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//Ensure uppercase and split string
|
|
||||||
String[] in = p.toUpperCase().split(",");
|
|
||||||
|
|
||||||
//Check, whether input have had a correct length. Length+1 divided by 3 should be exactly how much fields there are in the array.
|
|
||||||
//(2 chars or 2 chars followed by any times a comma and two chars)
|
|
||||||
if (in.length != (p.length() + 1) / 3)
|
|
||||||
{
|
|
||||||
throw new InvalidPlugboardConfigurationFormatException("Error parsing plugs! Maybe you missed a ','?");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//Create new 2 dimensional array for pairs of plugs
|
|
||||||
char[][] plugs = new char[(p.length() + 1) / 3][2];
|
|
||||||
//Fill the array
|
|
||||||
int i = 0;
|
|
||||||
for (String x : in)
|
|
||||||
{
|
|
||||||
//Check, whether string is not representing a pair
|
|
||||||
if (x.length() != 2)
|
|
||||||
{
|
|
||||||
throw new InvalidPlugboardConfigurationFormatException("Error parsing plugs! Maybe you didn't enter a pair somewhere?");
|
|
||||||
}
|
|
||||||
//If it does
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char[] pair = x.toCharArray();
|
|
||||||
//Check, if Plugs are in alphabet
|
|
||||||
if(pair[0]<65 || pair[1]<65 || pair[0]>90 || pair[1]>90) throw new InvalidPlugboardConfigurationFormatException("Error parsing plugs! Maybe you entered a number or a special character?");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//add it to the array
|
|
||||||
plugs[i] = pair;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return plugs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the plugboard to a new created object and set the configuration
|
|
||||||
*
|
|
||||||
* @param c configuration
|
|
||||||
* @throws Plugboard.PlugAlreadyUsedException
|
|
||||||
*/
|
|
||||||
public void setPlugboard(char[][] c) throws Plugboard.PlugAlreadyUsedException
|
|
||||||
{
|
|
||||||
plugboard = new Plugboard();
|
|
||||||
if (c != null)
|
|
||||||
{
|
|
||||||
//Set each plug pair
|
|
||||||
for (char[] x : c)
|
|
||||||
{
|
|
||||||
plugboard.setPlugPair(x[0], x[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,131 +168,41 @@ public class Enigma
|
||||||
*/
|
*/
|
||||||
public void setConfiguration(int[] conf)
|
public void setConfiguration(int[] conf)
|
||||||
{
|
{
|
||||||
if (conf.length != 10)
|
if (conf == null || conf.length != 10)
|
||||||
{
|
{
|
||||||
setConfiguration(Enigma.STANDARD_CONFIGURATION);
|
initialize();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
int ro1 = conf[0];
|
int ro1 = conf[0];
|
||||||
int ro2 = conf[1];
|
int ro2 = conf[1];
|
||||||
int ro3 = conf[2];
|
int ro3 = conf[2];
|
||||||
int ref = conf[3];
|
int ref = conf[3];
|
||||||
int r1rot = 26 + conf[4] - 1;
|
int ro1rot = normalize(conf[4] - 1);
|
||||||
int r2rot = 26 + conf[5] - 1;
|
int ro2rot = normalize(conf[5] - 1);
|
||||||
int r3rot = 26 + conf[6] - 1;
|
int ro3rot = normalize(conf[6] - 1);
|
||||||
int ro1Ring = conf[7];
|
int ro1Ring = conf[7];
|
||||||
int ro2Ring = conf[8];
|
int ro2Ring = conf[8];
|
||||||
int ro3Ring = conf[9];
|
int ro3Ring = conf[9];
|
||||||
|
|
||||||
//Set first rotor
|
//Set rotors
|
||||||
switch (ro1)
|
r1 = Rotor.createRotor(ro1, ro1Ring, ro1rot);
|
||||||
{
|
r2 = Rotor.createRotor(ro2, ro2Ring, ro2rot);
|
||||||
case 1:
|
r3 = Rotor.createRotor(ro3, ro3Ring, ro3rot);
|
||||||
{
|
|
||||||
r1 = new Rotor('1', (r1rot) % 26, ro1Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
r1 = new Rotor('2', (r1rot) % 26, ro1Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
r1 = new Rotor('3', (r1rot) % 26, ro1Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
r1 = new Rotor('4', (r1rot) % 26, ro1Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
{
|
|
||||||
r1 = new Rotor('5', (r1rot) % 26, ro1Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Set second rotor
|
|
||||||
switch (ro2)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
r2 = new Rotor('1', (r2rot) % 26, ro2Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
r2 = new Rotor('2', (r2rot) % 26, ro2Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
r2 = new Rotor('3', (r2rot) % 26, ro2Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
r2 = new Rotor('4', (r2rot) % 26, ro2Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
{
|
|
||||||
r2 = new Rotor('5', (r2rot) % 26, ro2Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Set third rotor
|
|
||||||
switch (ro3)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
r3 = new Rotor('1', (r3rot) % 26, ro3Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
r3 = new Rotor('2', (r3rot) % 26, ro3Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
r3 = new Rotor('3', (r3rot) % 26, ro3Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
{
|
|
||||||
r3 = new Rotor('4', (r3rot) % 26, ro3Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
{
|
|
||||||
r3 = new Rotor('5', (r3rot) % 26, ro3Ring);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Set reflector
|
//Set reflector
|
||||||
switch (ref)
|
reflector = Reflector.createReflector(ref);
|
||||||
{
|
|
||||||
case 1:
|
//catch double turn anomaly on step by step basis
|
||||||
{
|
this.doAnomaly = r2.doubleTurnAnomaly();
|
||||||
reflector = new Rotor('A', 0, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
reflector = new Rotor('B', 0, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
reflector = new Rotor('C', 0, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPlugboard(Plugboard p)
|
||||||
|
{
|
||||||
|
this.plugboard = p;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configuration, the enigma machine is in right NOW
|
* Return the configuration, the enigma machine is in right NOW
|
||||||
*
|
*
|
||||||
|
@ -366,32 +210,24 @@ public class Enigma
|
||||||
*/
|
*/
|
||||||
public int[] getConfiguration()
|
public int[] getConfiguration()
|
||||||
{
|
{
|
||||||
int[] c = new int[10];
|
int[] configuration = new int[10];
|
||||||
{
|
{
|
||||||
c[0] = r1.getType();
|
configuration[0] = r1.getType();
|
||||||
c[1] = r2.getType();
|
configuration[1] = r2.getType();
|
||||||
c[2] = r3.getType();
|
configuration[2] = r3.getType();
|
||||||
c[3] = reflector.getType();
|
configuration[3] = reflector.getType();
|
||||||
c[4] = r1.getCounter();
|
configuration[4] = r1.getRotation();
|
||||||
c[5] = r2.getCounter();
|
configuration[5] = r2.getRotation();
|
||||||
c[6] = r3.getCounter();
|
configuration[6] = r3.getRotation();
|
||||||
c[7] = r1.getRingsetting();
|
configuration[7] = r1.getRingSetting();
|
||||||
c[8] = r2.getRingsetting();
|
configuration[8] = r2.getRingSetting();
|
||||||
c[9] = r3.getRingsetting();
|
configuration[9] = r3.getRingSetting();
|
||||||
}
|
}
|
||||||
return c;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrefAnomaly(boolean b)
|
public void setPrefAnomaly(boolean b)
|
||||||
{
|
{
|
||||||
this.prefAnomaly = b;
|
this.prefAnomaly = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class InvalidPlugboardConfigurationFormatException extends Exception
|
|
||||||
{
|
|
||||||
public InvalidPlugboardConfigurationFormatException(String m)
|
|
||||||
{
|
|
||||||
super(m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
199
app/src/main/java/de/vanitasvitae/enigmandroid/MainActivity.java
Normal file → Executable file
|
@ -36,13 +36,15 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class MainActivity extends Activity
|
public class MainActivity extends Activity
|
||||||
{
|
{
|
||||||
|
private Menu menu;
|
||||||
private Spinner rotor1;
|
private Spinner rotor1;
|
||||||
private Spinner rotor2;
|
private Spinner rotor2;
|
||||||
private Spinner rotor3;
|
private Spinner rotor3;
|
||||||
private Spinner reversingRotor;
|
private Spinner reflector;
|
||||||
private Spinner rotor1Position;
|
private Spinner rotor1Position;
|
||||||
private Spinner rotor2Position;
|
private Spinner rotor2Position;
|
||||||
private Spinner rotor3Position;
|
private Spinner rotor3Position;
|
||||||
|
|
||||||
private EditText plugboard;
|
private EditText plugboard;
|
||||||
private EditText input;
|
private EditText input;
|
||||||
private EditText output;
|
private EditText output;
|
||||||
|
@ -51,9 +53,9 @@ public class MainActivity extends Activity
|
||||||
private static final String URI_CHANGELOG = "https://github.com/vanitasvitae/EnigmAndroid/blob/master/CHANGELOG.txt";
|
private static final String URI_CHANGELOG = "https://github.com/vanitasvitae/EnigmAndroid/blob/master/CHANGELOG.txt";
|
||||||
|
|
||||||
private Enigma enigma;
|
private Enigma enigma;
|
||||||
//memory for the ringsettings
|
//memory for the ringSettings
|
||||||
private int[] ringsettings = {0,0,0};
|
private int[] ringSettings = {0,0,0};
|
||||||
private boolean anomaly = true;
|
private boolean prefAnomaly;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
|
@ -61,13 +63,32 @@ public class MainActivity extends Activity
|
||||||
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.prefAnomaly = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("prefAnomaly", true);
|
||||||
|
this.resetLayout();
|
||||||
|
ActivitySingleton singleton = ActivitySingleton.getInstance();
|
||||||
|
singleton.setActivity(this);
|
||||||
|
|
||||||
|
//Handle shared text
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String action = intent.getAction();
|
||||||
|
String type = intent.getType();
|
||||||
|
|
||||||
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
|
if ("text/plain".equals(type))
|
||||||
|
{
|
||||||
|
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
|
if (sharedText != null)
|
||||||
|
{
|
||||||
|
input.setText(sharedText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
{
|
{
|
||||||
|
this.menu = menu;
|
||||||
this.getMenuInflater().inflate(R.menu.main, menu);
|
this.getMenuInflater().inflate(R.menu.main, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +102,7 @@ public class MainActivity extends Activity
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_reset)
|
if (id == R.id.action_reset)
|
||||||
{
|
{
|
||||||
this.reset();
|
this.resetLayout();
|
||||||
Toast.makeText(getApplicationContext(), R.string.message_reset,
|
Toast.makeText(getApplicationContext(), R.string.message_reset,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
return true;
|
return true;
|
||||||
|
@ -101,6 +122,21 @@ public class MainActivity extends Activity
|
||||||
showAboutDialog();
|
showAboutDialog();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (id == R.id.action_send)
|
||||||
|
{
|
||||||
|
if(output.getText().length() == 0)
|
||||||
|
{
|
||||||
|
Toast.makeText(this, R.string.error_no_text_to_send, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Intent sendIntent = new Intent();
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, output.getText().toString());
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
|
||||||
|
}
|
||||||
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,76 +151,56 @@ public class MainActivity extends Activity
|
||||||
conf[0] = rotor1.getSelectedItemPosition() + 1;
|
conf[0] = rotor1.getSelectedItemPosition() + 1;
|
||||||
conf[1] = rotor2.getSelectedItemPosition() + 1;
|
conf[1] = rotor2.getSelectedItemPosition() + 1;
|
||||||
conf[2] = rotor3.getSelectedItemPosition() + 1;
|
conf[2] = rotor3.getSelectedItemPosition() + 1;
|
||||||
conf[3] = reversingRotor.getSelectedItemPosition() + 1;
|
conf[3] = reflector.getSelectedItemPosition() + 1;
|
||||||
conf[4] = rotor1Position.getSelectedItemPosition() + 1;
|
conf[4] = rotor1Position.getSelectedItemPosition() + 1;
|
||||||
conf[5] = rotor2Position.getSelectedItemPosition() + 1;
|
conf[5] = rotor2Position.getSelectedItemPosition() + 1;
|
||||||
conf[6] = rotor3Position.getSelectedItemPosition() + 1;
|
conf[6] = rotor3Position.getSelectedItemPosition() + 1;
|
||||||
conf[7] = ringsettings[0];
|
conf[7] = ringSettings[0];
|
||||||
conf[8] = ringsettings[1];
|
conf[8] = ringSettings[1];
|
||||||
conf[9] = ringsettings[2];
|
conf[9] = ringSettings[2];
|
||||||
|
|
||||||
try
|
enigma = new Enigma();
|
||||||
{
|
|
||||||
enigma = new Enigma(null, null);
|
|
||||||
} catch (Plugboard.PlugAlreadyUsedException e)
|
|
||||||
{
|
|
||||||
//There is nothing that could possibly go wrong here.
|
|
||||||
}
|
|
||||||
|
|
||||||
char[][] plugboardConfiguration = null;
|
int[][] plugboardConfiguration = null;
|
||||||
try
|
plugboard.setText(plugboard.getText().toString().toUpperCase());
|
||||||
{
|
plugboardConfiguration = Plugboard.parseConfigurationString(plugboard.getText().toString());
|
||||||
plugboardConfiguration = Enigma.parsePlugs(plugboard.getText().toString());
|
enigma.setConfiguration(conf);
|
||||||
} catch (Enigma.InvalidPlugboardConfigurationFormatException e)
|
enigma.setPlugboard(new Plugboard(plugboardConfiguration));
|
||||||
{
|
enigma.setPrefAnomaly(prefAnomaly);
|
||||||
String error = this.getResources().getString(R.string.error_parsing_plugs) + ": " + e.getMessage();
|
|
||||||
Toast.makeText(getApplicationContext(), error,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
enigma.setConfiguration(conf);
|
|
||||||
enigma.setPlugboard(plugboardConfiguration);
|
|
||||||
enigma.setPrefAnomaly(anomaly);
|
|
||||||
|
|
||||||
} catch (Plugboard.PlugAlreadyUsedException e)
|
|
||||||
{
|
|
||||||
Toast.makeText(this.getApplicationContext(), e.getMessage(),
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the chosen Configuration to the enigma, get the input string from the input textbox and prepare it,
|
* Set the chosen Configuration to the enigma, get the input string from the input textbox and
|
||||||
* set the input to the prepared text, encrypt the prepared input and set the encrypted string to the
|
* prepare it, set the input to the prepared text, encrypt the prepared input and set the
|
||||||
* output textbox and update the spinners to their new positions.
|
* encrypted string to the output textbox and update the spinners to their new positions.
|
||||||
* @param v View
|
* @param v View
|
||||||
*/
|
*/
|
||||||
public void doCrypto(View v)
|
public void doCrypto(View v)
|
||||||
{
|
{
|
||||||
updateEnigma(null);
|
if(input.getText().length()!=0) {
|
||||||
String m = input.getText().toString();
|
updateEnigma(null);
|
||||||
m = Enigma.prepare(m);
|
String m = input.getText().toString();
|
||||||
input.setText(m);
|
m = Enigma.prepare(m);
|
||||||
output.setText(enigma.encrypt(m));
|
input.setText(m);
|
||||||
updateSpinner(enigma.getConfiguration());
|
output.setText(enigma.encrypt(m));
|
||||||
|
updateSpinner(enigma.getConfiguration());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset all the spinners and textboxes and the ringsettings memory
|
* Reset all the spinners and textboxes and the ringsettings memory
|
||||||
*/
|
*/
|
||||||
private void reset()
|
private void resetLayout()
|
||||||
{
|
{
|
||||||
rotor1.setSelection(0);
|
rotor1.setSelection(0);
|
||||||
rotor2.setSelection(1);
|
rotor2.setSelection(1);
|
||||||
rotor3.setSelection(2);
|
rotor3.setSelection(2);
|
||||||
reversingRotor.setSelection(1);
|
reflector.setSelection(1);
|
||||||
rotor1Position.setSelection(0);
|
rotor1Position.setSelection(0);
|
||||||
rotor2Position.setSelection(0);
|
rotor2Position.setSelection(0);
|
||||||
rotor3Position.setSelection(0);
|
rotor3Position.setSelection(0);
|
||||||
ringsettings = new int[]{0,0,0};
|
ringSettings = new int[]{0,0,0};
|
||||||
plugboard.setText("");
|
plugboard.setText("");
|
||||||
input.setText("");
|
input.setText("");
|
||||||
output.setText("");
|
output.setText("");
|
||||||
|
@ -195,6 +211,9 @@ public class MainActivity extends Activity
|
||||||
*/
|
*/
|
||||||
private void initLayout()
|
private void initLayout()
|
||||||
{
|
{
|
||||||
|
Character[] charArray = new Character[26];
|
||||||
|
for(int i=0; i<26; i++) {charArray[i] = (char) (65+i);}
|
||||||
|
|
||||||
rotor1 = (Spinner) findViewById(R.id.rotor1);
|
rotor1 = (Spinner) findViewById(R.id.rotor1);
|
||||||
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> rotor1Adapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.enigma_rotors, android.R.layout.simple_spinner_item);
|
R.array.enigma_rotors, android.R.layout.simple_spinner_item);
|
||||||
|
@ -214,31 +233,40 @@ public class MainActivity extends Activity
|
||||||
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
rotor3.setAdapter(rotor3Adapter);
|
rotor3.setAdapter(rotor3Adapter);
|
||||||
|
|
||||||
reversingRotor = (Spinner) findViewById(R.id.reflector);
|
reflector = (Spinner) findViewById(R.id.reflector);
|
||||||
ArrayAdapter<CharSequence> relfectorAdapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<CharSequence> relfectorAdapter = ArrayAdapter.createFromResource(this,
|
||||||
R.array.enigma_reflectors, android.R.layout.simple_spinner_item);
|
R.array.enigma_reflectors, android.R.layout.simple_spinner_item);
|
||||||
relfectorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
relfectorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
reversingRotor.setAdapter(relfectorAdapter);
|
reflector.setAdapter(relfectorAdapter);
|
||||||
|
|
||||||
rotor1Position = (Spinner) findViewById(R.id.rotor1position);
|
rotor1Position = (Spinner) findViewById(R.id.rotor1position);
|
||||||
ArrayAdapter<CharSequence> rotor1PositionAdapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<Character> rotor1PositionAdapter = new ArrayAdapter<>(this.getApplicationContext(),
|
||||||
R.array.rotor_positions, android.R.layout.simple_spinner_item);
|
android.R.layout.simple_spinner_item,charArray);
|
||||||
rotor1PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor1PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
rotor1Position.setAdapter(rotor1PositionAdapter);
|
rotor1Position.setAdapter(rotor1PositionAdapter);
|
||||||
|
|
||||||
rotor2Position = (Spinner) findViewById(R.id.rotor2position);
|
rotor2Position = (Spinner) findViewById(R.id.rotor2position);
|
||||||
ArrayAdapter<CharSequence> rotor2PositionAdapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<Character> rotor2PositionAdapter = new ArrayAdapter<>(this.getApplicationContext(),
|
||||||
R.array.rotor_positions, android.R.layout.simple_spinner_item);
|
android.R.layout.simple_spinner_item,charArray);
|
||||||
rotor2PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor2PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
rotor2Position.setAdapter(rotor2PositionAdapter);
|
rotor2Position.setAdapter(rotor2PositionAdapter);
|
||||||
|
|
||||||
rotor3Position = (Spinner) findViewById(R.id.rotor3position);
|
rotor3Position = (Spinner) findViewById(R.id.rotor3position);
|
||||||
ArrayAdapter<CharSequence> rotor3PositionAdapter = ArrayAdapter.createFromResource(this,
|
ArrayAdapter<Character> rotor3PositionAdapter = new ArrayAdapter<>(this.getApplicationContext(),
|
||||||
R.array.rotor_positions, android.R.layout.simple_spinner_item);
|
android.R.layout.simple_spinner_item,charArray);
|
||||||
rotor3PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
rotor3PositionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
rotor3Position.setAdapter(rotor3PositionAdapter);
|
rotor3Position.setAdapter(rotor3PositionAdapter);
|
||||||
|
|
||||||
plugboard = (EditText) findViewById(R.id.plugboard);
|
plugboard = (EditText) findViewById(R.id.plugboard);
|
||||||
|
plugboard.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if(!hasFocus)
|
||||||
|
{
|
||||||
|
plugboard.setText(plugboard.getText().toString().toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
input = (EditText) findViewById(R.id.input);
|
input = (EditText) findViewById(R.id.input);
|
||||||
output = (EditText) findViewById(R.id.output);
|
output = (EditText) findViewById(R.id.output);
|
||||||
|
|
||||||
|
@ -260,29 +288,36 @@ public class MainActivity extends Activity
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the dialog where the user can pick the ringsettings and set them if the user doesn't abort.
|
* Show the dialog where the user can pick the ringsettings and set them if the user doesn't
|
||||||
|
* abort.
|
||||||
*/
|
*/
|
||||||
public void showRingsettingsDialog()
|
public void showRingsettingsDialog()
|
||||||
{
|
{
|
||||||
View ringsettingsView = View.inflate(this, R.layout.dialog_ringsettings, null);
|
View ringsettingsView = View.inflate(this, R.layout.dialog_ringsettings, null);
|
||||||
|
|
||||||
|
Integer[] ringArray = new Integer[26];
|
||||||
|
for(int i=1; i<=26; i++) {ringArray[i-1] = i;}
|
||||||
|
|
||||||
final Spinner ring1 = (Spinner) ringsettingsView.findViewById(R.id.rotor1ring);
|
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);
|
ArrayAdapter<Integer> ring1Adapter = new ArrayAdapter<>(this.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item,ringArray);
|
||||||
ring1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
ring1Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
ring1.setAdapter(ring1Adapter);
|
ring1.setAdapter(ring1Adapter);
|
||||||
ring1.setSelection(ringsettings[0]);
|
ring1.setSelection(ringSettings[0]);
|
||||||
|
|
||||||
final Spinner ring2 = (Spinner) ringsettingsView.findViewById(R.id.rotor2ring);
|
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);
|
ArrayAdapter<Integer> ring2Adapter = new ArrayAdapter<>(this.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item,ringArray);
|
||||||
ring2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
ring2Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
ring2.setAdapter(ring2Adapter);
|
ring2.setAdapter(ring2Adapter);
|
||||||
ring2.setSelection(ringsettings[1]);
|
ring2.setSelection(ringSettings[1]);
|
||||||
|
|
||||||
final Spinner ring3 = (Spinner) ringsettingsView.findViewById(R.id.rotor3ring);
|
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);
|
ArrayAdapter<Integer> ring3Adapter = new ArrayAdapter<>(this.getApplicationContext(),
|
||||||
|
android.R.layout.simple_spinner_item,ringArray);
|
||||||
ring3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
ring3Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
ring3.setAdapter(ring3Adapter);
|
ring3.setAdapter(ring3Adapter);
|
||||||
ring3.setSelection(ringsettings[2]);
|
ring3.setSelection(ringSettings[2]);
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.title_ringsetting);
|
builder.setTitle(R.string.title_ringsetting);
|
||||||
|
@ -292,8 +327,10 @@ public class MainActivity extends Activity
|
||||||
{
|
{
|
||||||
public void onClick(DialogInterface dialog, int id)
|
public void onClick(DialogInterface dialog, int id)
|
||||||
{
|
{
|
||||||
ringsettings = new int[]{ring1.getSelectedItemPosition(), ring2.getSelectedItemPosition(), ring3.getSelectedItemPosition()};
|
ringSettings = new int[]{ring1.getSelectedItemPosition(),
|
||||||
String message = getResources().getString(R.string.dialog_ringsettings_success) + " " + (ringsettings[2]+1) + ", " + (ringsettings[1]+1) + ", " + (ringsettings[0]+1) + ".";
|
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.makeText(getApplicationContext(), message,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
@ -341,7 +378,7 @@ public class MainActivity extends Activity
|
||||||
case RESULT_SETTINGS:
|
case RESULT_SETTINGS:
|
||||||
{
|
{
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
this.anomaly = sharedPrefs.getBoolean("prefAnomaly", true);
|
this.prefAnomaly = sharedPrefs.getBoolean("prefAnomaly", true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,4 +391,28 @@ public class MainActivity extends Activity
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ActivitySingleton
|
||||||
|
{
|
||||||
|
private static ActivitySingleton instance = null;
|
||||||
|
private Activity activity;
|
||||||
|
|
||||||
|
private ActivitySingleton(){}
|
||||||
|
public static ActivitySingleton getInstance()
|
||||||
|
{
|
||||||
|
if(instance == null) instance = new ActivitySingleton();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivity(Activity activity)
|
||||||
|
{
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Activity getActivity()
|
||||||
|
{
|
||||||
|
return activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,102 +1,145 @@
|
||||||
package de.vanitasvitae.enigmandroid;
|
package de.vanitasvitae.enigmandroid;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing the plugboard
|
* Created by vanitas on 12.08.15.
|
||||||
*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 Plugboard
|
public class Plugboard
|
||||||
{
|
{
|
||||||
//Plugboard
|
Integer[] plugs;
|
||||||
// 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
|
|
||||||
|
|
||||||
//Array containing plugged pairs
|
|
||||||
int[] pb;
|
|
||||||
//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};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create new plugboard without any plugged pairs. (empty, no scrambling here)
|
|
||||||
*/
|
|
||||||
public Plugboard()
|
public Plugboard()
|
||||||
{
|
{
|
||||||
pb = new int[26];
|
plugs = new Integer[26];
|
||||||
resetPlugboard();
|
}
|
||||||
|
|
||||||
|
public Plugboard(int[][] configuration)
|
||||||
|
{
|
||||||
|
setConfiguration(configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plugboard(String configuration)
|
||||||
|
{
|
||||||
|
setConfiguration(parseConfigurationString(configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* En-/decrypt a char following the connections on the plugboard
|
* Configure the plugboard according to the given array.
|
||||||
*
|
*
|
||||||
* @param x char to perform crypto on
|
* @param configuration
|
||||||
* @return en-/decrypted char
|
|
||||||
*/
|
*/
|
||||||
public int encrypt(int x)
|
public void setConfiguration(int[][] configuration)
|
||||||
{
|
{
|
||||||
return pb[x];
|
if(configuration != null) {
|
||||||
|
boolean validConfiguration = true;
|
||||||
|
plugs = new Integer[26];
|
||||||
|
for (int[] p : configuration) {
|
||||||
|
if (!setPlugs(p[0], p[1])) {
|
||||||
|
validConfiguration = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!validConfiguration) plugs = new Integer[26];
|
||||||
|
}
|
||||||
|
else plugs = new Integer[26];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the plugboard (no plugged pairs)
|
* Parse configuration from input string
|
||||||
|
* input must have the following form: "" or "XY" or "XY,VW" or "XY,...,AB"
|
||||||
|
* A character must not be inside the input multiple times. Exception is ','
|
||||||
|
* This is not catched here!
|
||||||
|
* @param input String that codes the configuration
|
||||||
|
* @return two dimensional array of plugged symbols
|
||||||
*/
|
*/
|
||||||
public void resetPlugboard()
|
public static int[][] parseConfigurationString(String input)
|
||||||
{
|
{
|
||||||
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};
|
Activity activity = MainActivity.ActivitySingleton.getInstance().getActivity();
|
||||||
|
//If length != 0,2,5,8... ( ,XY, XY-VW, ...)
|
||||||
|
if(((input.length()+1)%3)!=0&&input.length()!=0)
|
||||||
|
{
|
||||||
|
Toast.makeText(activity.getApplicationContext(), R.string.error_parsing_plugs,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
input = input.toUpperCase();
|
||||||
|
ArrayList<int[]> plugList = new ArrayList<int[]>();
|
||||||
|
int[] plug = new int[2];
|
||||||
|
for (int i = 0; i < input.length(); i++) {
|
||||||
|
int c = input.charAt(i) - 65;
|
||||||
|
if (c < 0 || c > 25) {
|
||||||
|
if (i % 3 != 2) {
|
||||||
|
Toast.makeText(activity.getApplicationContext(), R.string.error_parsing_plugs,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (i % 3 == 0) {
|
||||||
|
plug = new int[2];
|
||||||
|
plug[0] = c;
|
||||||
|
}
|
||||||
|
if (i % 3 == 1) {
|
||||||
|
plug[1] = c;
|
||||||
|
plugList.add(plug);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int[][] parsedConfiguration = new int[plugList.size()][2];
|
||||||
|
for(int i=0; i<plugList.size(); i++)
|
||||||
|
{
|
||||||
|
parsedConfiguration[i] = plugList.get(i);
|
||||||
|
}
|
||||||
|
return parsedConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a pair of plugs on the plugboard
|
* Set the given plugs (connect a and b)
|
||||||
*
|
* Return false, if something goes wrong (plugs already used somehow)
|
||||||
* @param a first Plug
|
* @param a first plug
|
||||||
* @param b second Plug
|
* @param b second plug
|
||||||
|
* @return success
|
||||||
*/
|
*/
|
||||||
public void setPlugPair(char a, char b) throws PlugAlreadyUsedException
|
public boolean setPlugs(int a, int b)
|
||||||
{
|
{
|
||||||
//prevent to plug a plug to itself
|
Activity activity = MainActivity.ActivitySingleton.getInstance().getActivity();
|
||||||
if (a == b)
|
if(a==b)
|
||||||
{
|
{
|
||||||
throw new PlugAlreadyUsedException("Unable to plug " + a + " to " + a);
|
Toast.makeText(activity.getApplication().getApplicationContext(),
|
||||||
|
activity.getResources().getText(R.string.error_unable_to_plug_a_b).toString()
|
||||||
|
+" "+(char)(a+65)+","+(char) (b+65),Toast.LENGTH_LONG).show();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
int x = a - 65;
|
if(plugs[a] != null || plugs[b] != null)
|
||||||
int y = b - 65;
|
|
||||||
//Check, if plugs already plugged
|
|
||||||
if (pb[x] != ref[x])
|
|
||||||
{
|
{
|
||||||
throw new PlugAlreadyUsedException("Plug " + a + " used twice!");
|
Toast.makeText(activity.getApplication().getApplicationContext(),
|
||||||
} else if (pb[y] != ref[y])
|
activity.getResources().getText(R.string.error_plug_already_in_use).toString()
|
||||||
{
|
+" "+(char) (a+65)+","+(char)(b +65), Toast.LENGTH_SHORT).show();
|
||||||
throw new PlugAlreadyUsedException("Plug " + b + " used twice!");
|
return false;
|
||||||
}
|
}
|
||||||
//If everything is correct
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//set the pair
|
plugs[a] = b;
|
||||||
int c = pb[x];
|
plugs[b] = a;
|
||||||
pb[x] = pb[y];
|
return true;
|
||||||
pb[y] = c;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PlugAlreadyUsedException extends Exception
|
/**
|
||||||
|
* Encrypt input via plugboard connections
|
||||||
|
* @param input input symbol to encrypt
|
||||||
|
* @return encrypted symbol
|
||||||
|
*/
|
||||||
|
public int encrypt(int input)
|
||||||
{
|
{
|
||||||
public PlugAlreadyUsedException(String m)
|
if(plugs[input]==null) return input;
|
||||||
{
|
else return plugs[input];
|
||||||
super(m);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,256 +0,0 @@
|
||||||
package de.vanitasvitae.enigmandroid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class representing a rotor of the Enigma machine (I-V,A-C)
|
|
||||||
*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 vanitas
|
|
||||||
*/
|
|
||||||
public class Rotor
|
|
||||||
{
|
|
||||||
// 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
|
|
||||||
//ABC: 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
|
|
||||||
//Rotor1: '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'
|
|
||||||
//Rotor2: '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'
|
|
||||||
//Rotor3: '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'
|
|
||||||
//Rotor4: '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'
|
|
||||||
//Rotor5: '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'
|
|
||||||
//Reversing Rotor A: AE BJ CM DZ FL GY HX IV KW NR OQ PU ST
|
|
||||||
//Reversing Rotor B: AY BR CU DH EQ FS GL IP JX KN MO TZ VW
|
|
||||||
//Reversing Rotor C: AF BV CP DJ EI GO HY KR LZ MX NW QT SU
|
|
||||||
|
|
||||||
//Original rotors
|
|
||||||
public static final Integer[] rotor1 = {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};
|
|
||||||
public static final Integer[] rotor2 = {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};
|
|
||||||
public static final Integer[] rotor3 = {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};
|
|
||||||
public static final Integer[] rotor4 = {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};
|
|
||||||
public static final Integer[] rotor5 = {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};
|
|
||||||
//Original rotors backwards direction
|
|
||||||
public static final Integer[] backwardsRotor1 = {20, 22, 24, 6, 0, 3, 5, 15, 21, 25, 1, 4, 2, 10, 12, 19, 7, 23, 18, 11, 17, 8, 13, 16, 14, 9};
|
|
||||||
public static final Integer[] backwardsRotor2 = {0, 9, 15, 2, 25, 22, 17, 11, 5, 1, 3, 10, 14, 19, 24, 20, 16, 6, 4, 13, 7, 23, 12, 8, 21, 18};
|
|
||||||
public static final Integer[] backwardsRotor3 = {19, 0, 6, 1, 15, 2, 18, 3, 16, 4, 20, 5, 21, 13, 25, 7, 24, 8, 23, 9, 22, 11, 17, 10, 14, 12};
|
|
||||||
public static final Integer[] backwardsRotor4 = {7, 25, 22, 21, 0, 17, 19, 13, 11, 6, 20, 15, 23, 16, 2, 4, 9, 12, 1, 18, 10, 3, 24, 14, 8, 5};
|
|
||||||
public static final Integer[] backwardsRotor5 = {16, 2, 24, 11, 23, 22, 4, 13, 5, 19, 25, 14, 18, 12, 21, 9, 20, 3, 10, 6, 8, 0, 17, 15, 7, 1};
|
|
||||||
|
|
||||||
//Original reflector rotors A,B,C, D, E,F, G, H, I, J,K, L,M,N, O, P, Q, R, S, T, U, V,W, X,Y,Z
|
|
||||||
public static final Integer[] reflectorA = {4, 9, 12, 25, 0, 11, 24, 23, 21, 1, 22, 5, 2, 17, 16, 20, 14, 13, 19, 18, 15, 8, 10, 7, 6, 3};
|
|
||||||
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};
|
|
||||||
|
|
||||||
//Attributes of the rotor
|
|
||||||
private Integer[] rotor; //choose one of rotor1-5
|
|
||||||
private Integer[] backwardsRotor; //choose one of backwardsRotor1-5
|
|
||||||
private int ringsetting;
|
|
||||||
private int turnOver;
|
|
||||||
private int counter;
|
|
||||||
private String name;
|
|
||||||
private int type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create new Rotor (1 - 5 = normal rotor, -1 - -3 = reversing rotor)
|
|
||||||
*
|
|
||||||
* @param type integer determines type
|
|
||||||
* @param setting setting (rotation) of the rotor
|
|
||||||
*/
|
|
||||||
public Rotor(char type, int setting, int ring)
|
|
||||||
{
|
|
||||||
this.ringsetting = ring;
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case '1':
|
|
||||||
{
|
|
||||||
this.rotor = rotor1;
|
|
||||||
this.backwardsRotor = backwardsRotor1;
|
|
||||||
this.counter = setting;
|
|
||||||
this.name = "I";
|
|
||||||
this.turnOver = 17; //"Royal"
|
|
||||||
this.type = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '2':
|
|
||||||
{
|
|
||||||
this.rotor = rotor2;
|
|
||||||
this.backwardsRotor = backwardsRotor2;
|
|
||||||
this.counter = setting;
|
|
||||||
this.name = "II";
|
|
||||||
this.turnOver = 5; //"Flags"
|
|
||||||
this.type = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '3':
|
|
||||||
{
|
|
||||||
this.rotor = rotor3;
|
|
||||||
this.backwardsRotor = backwardsRotor3;
|
|
||||||
this.counter = setting;
|
|
||||||
this.name = "III";
|
|
||||||
this.turnOver = 22; //"Wave"
|
|
||||||
this.type = 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '4':
|
|
||||||
{
|
|
||||||
this.rotor = rotor4;
|
|
||||||
this.backwardsRotor = backwardsRotor4;
|
|
||||||
this.counter = setting;
|
|
||||||
this.name = "IV";
|
|
||||||
this.turnOver = 10; //"Kings"
|
|
||||||
this.type = 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '5':
|
|
||||||
{
|
|
||||||
this.rotor = rotor5;
|
|
||||||
this.backwardsRotor = backwardsRotor5;
|
|
||||||
this.counter = setting;
|
|
||||||
this.name = "V";
|
|
||||||
this.turnOver = 0; //"Above"
|
|
||||||
this.type = 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'A':
|
|
||||||
{
|
|
||||||
this.rotor = reflectorA;
|
|
||||||
this.backwardsRotor = null;
|
|
||||||
this.counter = 0;
|
|
||||||
this.name = "A";
|
|
||||||
this.type = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'B':
|
|
||||||
{
|
|
||||||
this.rotor = reflectorB;
|
|
||||||
this.backwardsRotor = null;
|
|
||||||
this.counter = 0;
|
|
||||||
this.name = "B";
|
|
||||||
this.type = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'C':
|
|
||||||
{
|
|
||||||
this.rotor = reflectorC;
|
|
||||||
this.backwardsRotor = null;
|
|
||||||
this.counter = 0;
|
|
||||||
this.name = "C";
|
|
||||||
this.type = 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* encrypt in forward direction (forward means first half of the cycle through the rotors)
|
|
||||||
*
|
|
||||||
* @param x incoming character
|
|
||||||
* @return encrypted character
|
|
||||||
*/
|
|
||||||
public int encryptForward(int x)
|
|
||||||
{
|
|
||||||
return this.rotor[(26 + x) % 26];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* encrypt in backward direction (coming from the reversing rotor)
|
|
||||||
*
|
|
||||||
* @param x incoming character
|
|
||||||
* @return encrypted character
|
|
||||||
*/
|
|
||||||
public int encryptBackward(int x)
|
|
||||||
{
|
|
||||||
if (this.backwardsRotor == null) return this.rotor[(26 + x) % 26];
|
|
||||||
else return this.backwardsRotor[(26 + x) % 26];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return rotation of the rotor - the ringsetting
|
|
||||||
*
|
|
||||||
* @return rotation
|
|
||||||
*/
|
|
||||||
public int getCounter()
|
|
||||||
{
|
|
||||||
return this.counter - this.getRingsetting();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* increment rotation of the rotor by one.
|
|
||||||
*/
|
|
||||||
public void incrementCounter()
|
|
||||||
{
|
|
||||||
this.counter = (this.counter + 1) % 26;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true, if rotor is at a position, where it turns over the next rotor
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean isAtTurnoverPosition()
|
|
||||||
{
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
return this.turnOver;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
/**
|
|
||||||
* Return the name of the rotor
|
|
||||||
* @return name
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
/**
|
|
||||||
* Return ringsettings of the rotor
|
|
||||||
* @return ringsetting
|
|
||||||
*/
|
|
||||||
public int getRingsetting()
|
|
||||||
{
|
|
||||||
return this.ringsetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the integer, which was used to create this rotor.
|
|
||||||
*
|
|
||||||
* @return the type of the rotor
|
|
||||||
*/
|
|
||||||
public int getType()
|
|
||||||
{
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
}
|
|
0
app/src/main/java/de/vanitasvitae/enigmandroid/SettingsActivity.java
Normal file → Executable file
|
@ -0,0 +1,93 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.rotors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by vanitas on 11.08.15.
|
||||||
|
*/
|
||||||
|
public class Reflector
|
||||||
|
{
|
||||||
|
protected String name;
|
||||||
|
protected int type;
|
||||||
|
protected Integer[] connections;
|
||||||
|
|
||||||
|
protected Reflector(String name, int type, Integer[] connections)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.connections = connections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Reflector createReflectorA()
|
||||||
|
{
|
||||||
|
return new ReflectorA();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Reflector createReflectorB()
|
||||||
|
{
|
||||||
|
return new ReflectorB();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Reflector createReflectorC()
|
||||||
|
{
|
||||||
|
return new ReflectorC();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Reflector createReflector(int type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 1: return createReflectorA();
|
||||||
|
case 2: return createReflectorB();
|
||||||
|
default: return createReflectorC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int encrypt(int input)
|
||||||
|
{
|
||||||
|
return this.connections[normalize(input)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType()
|
||||||
|
{
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getRotorSize()
|
||||||
|
{
|
||||||
|
return this.connections.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int normalize(int input)
|
||||||
|
{
|
||||||
|
return (input + this.getRotorSize()) % this.getRotorSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ReflectorA extends Reflector
|
||||||
|
{
|
||||||
|
public ReflectorA()
|
||||||
|
{
|
||||||
|
super("A", 1, new Integer[]{4, 9, 12, 25, 0, 11, 24, 23, 21, 1, 22, 5, 2, 17, 16, 20, 14, 13, 19, 18, 15, 8, 10, 7, 6, 3});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ReflectorB extends Reflector
|
||||||
|
{
|
||||||
|
public ReflectorB()
|
||||||
|
{
|
||||||
|
super("B", 2, new Integer[]{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});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ReflectorC extends Reflector
|
||||||
|
{
|
||||||
|
public ReflectorC()
|
||||||
|
{
|
||||||
|
super("C", 3, new Integer[]{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});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
208
app/src/main/java/de/vanitasvitae/enigmandroid/rotors/Rotor.java
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
package de.vanitasvitae.enigmandroid.rotors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by vanitas on 11.08.15.
|
||||||
|
*/
|
||||||
|
public class Rotor
|
||||||
|
{
|
||||||
|
protected String name;
|
||||||
|
protected int type;
|
||||||
|
protected Integer[] connections;
|
||||||
|
protected Integer[] reversedConnections;
|
||||||
|
protected int turnOverNotch;
|
||||||
|
|
||||||
|
protected int ringSetting;
|
||||||
|
protected int rotation;
|
||||||
|
|
||||||
|
protected Rotor(String name, int type, Integer[] connections, Integer[] reversedConnections,
|
||||||
|
int turnOverNotch, int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.connections = connections;
|
||||||
|
this.reversedConnections = reversedConnections;
|
||||||
|
this.turnOverNotch = turnOverNotch;
|
||||||
|
this.ringSetting = ringSetting;
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rotor createRotor(int type, int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 1: return createRotorI(ringSetting, rotation);
|
||||||
|
case 2: return createRotorII(ringSetting, rotation);
|
||||||
|
case 3: return createRotorIII(ringSetting, rotation);
|
||||||
|
case 4: return createRotorIV(ringSetting, rotation);
|
||||||
|
default: return createRotorV(ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rotor createRotorI(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
return new RotorI(ringSetting, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rotor createRotorII(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
return new RotorII(ringSetting, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rotor createRotorIII(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
return new RotorIII(ringSetting, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rotor createRotorIV(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
return new RotorIV(ringSetting, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rotor createRotorV(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
return new RotorV(ringSetting, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int encryptForward(int input)
|
||||||
|
{
|
||||||
|
return this.connections[normalize(input)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int encryptBackward(int input)
|
||||||
|
{
|
||||||
|
return this.reversedConnections[normalize(input)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType()
|
||||||
|
{
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRotation()
|
||||||
|
{
|
||||||
|
return this.rotation - this.getRingSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* increment rotation of the rotor by one.
|
||||||
|
*/
|
||||||
|
public void rotate()
|
||||||
|
{
|
||||||
|
this.rotation = normalize(this.getRotation()+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true, if rotor is at a position, where it turns over the next rotor
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isAtTurnoverPosition()
|
||||||
|
{
|
||||||
|
return this.rotation == this.turnOverNotch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Double Turn Anomaly (deutsch: Doppelsprung Anomalie) is an 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.rotation == this.turnOverNotch - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
/**
|
||||||
|
* Returns the position of the turnover notch
|
||||||
|
*
|
||||||
|
* @return turnOver
|
||||||
|
*/
|
||||||
|
public int getTurnOver()
|
||||||
|
{
|
||||||
|
return this.turnOverNotch;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
/**
|
||||||
|
* Return ringSettings of the rotor
|
||||||
|
* @return ringSetting
|
||||||
|
*/
|
||||||
|
public int getRingSetting()
|
||||||
|
{
|
||||||
|
return this.ringSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRotorSize()
|
||||||
|
{
|
||||||
|
return this.connections.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int normalize(int input)
|
||||||
|
{
|
||||||
|
return (input + this.getRotorSize()) % this.getRotorSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RotorI extends Rotor
|
||||||
|
{
|
||||||
|
public RotorI(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
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[]{20, 22, 24, 6, 0, 3, 5, 15, 21, 25, 1, 4, 2, 10, 12, 19, 7, 23, 18, 11, 17, 8, 13, 16, 14, 9},
|
||||||
|
17, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RotorII extends Rotor
|
||||||
|
{
|
||||||
|
public RotorII(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
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, 15, 2, 25, 22, 17, 11, 5, 1, 3, 10, 14, 19, 24, 20, 16, 6, 4, 13, 7, 23, 12, 8, 21, 18},
|
||||||
|
5, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RotorIII extends Rotor
|
||||||
|
{
|
||||||
|
public RotorIII(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
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[]{19, 0, 6, 1, 15, 2, 18, 3, 16, 4, 20, 5, 21, 13, 25, 7, 24, 8, 23, 9, 22, 11, 17, 10, 14, 12},
|
||||||
|
22, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RotorIV extends Rotor
|
||||||
|
{
|
||||||
|
public RotorIV(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
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[]{7, 25, 22, 21, 0, 17, 19, 13, 11, 6, 20, 15, 23, 16, 2, 4, 9, 12, 1, 18, 10, 3, 24, 14, 8, 5},
|
||||||
|
10, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RotorV extends Rotor
|
||||||
|
{
|
||||||
|
public RotorV(int ringSetting, int rotation)
|
||||||
|
{
|
||||||
|
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[]{16, 2, 24, 11, 23, 22, 4, 13, 5, 19, 25, 14, 18, 12, 21, 9, 20, 3, 10, 6, 8, 0, 17, 15, 7, 1},
|
||||||
|
0, ringSetting, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
0
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
app/src/main/res/drawable-ldrtl-hdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
app/src/main/res/drawable-ldrtl-mdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
app/src/main/res/drawable-ldrtl-xhdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
app/src/main/res/drawable-ldrtl-xxhdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 798 B |
BIN
app/src/main/res/drawable-ldrtl-xxxhdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
0
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 344 B |
0
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 586 B |
0
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 806 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_send_white_48dp.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
0
app/src/main/res/drawable/button.xml
Normal file → Executable file
0
app/src/main/res/ic_launcher-web.png
Normal file → Executable file
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
0
app/src/main/res/layout-land/activity_main.xml
Normal file → Executable file
0
app/src/main/res/layout/activity_main.xml
Normal file → Executable file
4
app/src/main/res/layout/dialog_about.xml
Normal file → Executable file
|
@ -1,7 +1,9 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
4
app/src/main/res/layout/dialog_ringsettings.xml
Normal file → Executable file
|
@ -1,7 +1,9 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
7
app/src/main/res/menu/main.xml
Normal file → Executable file
|
@ -3,9 +3,14 @@
|
||||||
tools:context=".MainActivity" >
|
tools:context=".MainActivity" >
|
||||||
|
|
||||||
<item android:id="@+id/action_reset"
|
<item android:id="@+id/action_reset"
|
||||||
android:orderInCategory="97"
|
android:orderInCategory="96"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/action_reset" />
|
android:title="@string/action_reset" />
|
||||||
|
<item android:id="@+id/action_send"
|
||||||
|
android:orderInCategory="97"
|
||||||
|
android:showAsAction="always"
|
||||||
|
android:title="@string/action_send"
|
||||||
|
android:icon="@drawable/ic_send_white_48dp"/>
|
||||||
<item android:id="@+id/action_choose_ringstellung"
|
<item android:id="@+id/action_choose_ringstellung"
|
||||||
android:title="@string/action_choose_ringsettings"
|
android:title="@string/action_choose_ringsettings"
|
||||||
android:orderInCategory="98"
|
android:orderInCategory="98"
|
||||||
|
|
2
app/src/main/res/values-de/about_dialog_resources.xml
Normal file → Executable file
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<string name="title_section_how_to_use">Bedienungsanleitung</string>
|
<string name="title_section_how_to_use">Bedienungsanleitung</string>
|
||||||
<string name="section_how_to_use">Um einen Text mit EnigmAndroid zu ver- oder entschlüsseln, tippen Sie den Klar- oder Geheimtext in das Feld \"Hier tippen\".
|
<string name="section_how_to_use">Um einen Text mit EnigmAndroid zu ver- oder entschlüsseln, tippen Sie den Klar- oder Geheimtext in das Feld \"Hier tippen\".
|
||||||
Wählen Sie anschließend eine Umkehrwalze, und Walzen für die Plätze 1 bis 3 aus. Legen Sie außerdem die Startpositionen der Walzen fest.
|
Wählen Sie anschließend eine Umkehrwalze, sowie Walzen für die Plätze 1 bis 3 aus. Legen Sie außerdem die Startpositionen der Walzen fest.
|
||||||
Zuletzt können Sie noch einige Steckerpaare auf dem Steckbrett festlegen. Tippen Sie dazu die gewünschten Paare mit Komma getrennt in das entsprechende Textfeld (zb. \"ab,cd\").
|
Zuletzt können Sie noch einige Steckerpaare auf dem Steckbrett festlegen. Tippen Sie dazu die gewünschten Paare mit Komma getrennt in das entsprechende Textfeld (zb. \"ab,cd\").
|
||||||
Beachten Sie, dass Sie einen Stecker nicht doppelt nutzen dürfen.
|
Beachten Sie, dass Sie einen Stecker nicht doppelt nutzen dürfen.
|
||||||
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 auch noch die Ringstellung definieren. Öffnen Sie dazu das Optionsmenü und wählen Sie den Punkt \"Ringstellung\".
|
||||||
|
|
60
app/src/main/res/values-de/strings.xml
Normal file → Executable file
|
@ -6,6 +6,8 @@
|
||||||
<string name="action_reset">Zurücksetzen</string>
|
<string name="action_reset">Zurücksetzen</string>
|
||||||
<string name="action_settings">Einstellungen</string>
|
<string name="action_settings">Einstellungen</string>
|
||||||
<string name="action_choose_ringsettings">Ringstellung</string>
|
<string name="action_choose_ringsettings">Ringstellung</string>
|
||||||
|
<string name="action_send">Senden</string>
|
||||||
|
<string name="send_to">Senden an…</string>
|
||||||
<string name="message_choose_ringsettings">Wähle die Ringstellungen für die Walzen:</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_type_here">Hier Tippen</string>
|
||||||
<string name="hint_enigma_code">Enigma-Code</string>
|
<string name="hint_enigma_code">Enigma-Code</string>
|
||||||
|
@ -21,6 +23,7 @@
|
||||||
<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="error_no_text_to_send">Nachricht ist leer.</string>
|
||||||
<string name="title_ringsetting">Ringstellungen</string>
|
<string name="title_ringsetting">Ringstellungen</string>
|
||||||
<string name="dialog_positiv">OK</string>
|
<string name="dialog_positiv">OK</string>
|
||||||
<string name="dialog_negativ">Abbrechen</string>
|
<string name="dialog_negativ">Abbrechen</string>
|
||||||
|
@ -35,66 +38,11 @@
|
||||||
<item>IV</item>
|
<item>IV</item>
|
||||||
<item>V</item>
|
<item>V</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="enigma_reflectors">
|
<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="rotor_positions">
|
|
||||||
<item>A</item>
|
|
||||||
<item>B</item>
|
|
||||||
<item>C</item>
|
|
||||||
<item>D</item>
|
|
||||||
<item>E</item>
|
|
||||||
<item>F</item>
|
|
||||||
<item>G</item>
|
|
||||||
<item>H</item>
|
|
||||||
<item>I</item>
|
|
||||||
<item>J</item>
|
|
||||||
<item>K</item>
|
|
||||||
<item>L</item>
|
|
||||||
<item>M</item>
|
|
||||||
<item>N</item>
|
|
||||||
<item>O</item>
|
|
||||||
<item>P</item>
|
|
||||||
<item>Q</item>
|
|
||||||
<item>R</item>
|
|
||||||
<item>S</item>
|
|
||||||
<item>T</item>
|
|
||||||
<item>U</item>
|
|
||||||
<item>V</item>
|
|
||||||
<item>W</item>
|
|
||||||
<item>X</item>
|
|
||||||
<item>Y</item>
|
|
||||||
<item>Z</item>
|
|
||||||
</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>
|
||||||
|
|
0
app/src/main/res/values-de/strings_activity_settings.xml
Normal file → Executable file
0
app/src/main/res/values-w820dp/dimens.xml
Normal file → Executable file
0
app/src/main/res/values/about_dialog_resources.xml
Normal file → Executable file
0
app/src/main/res/values/dimens.xml
Normal file → Executable file
75
app/src/main/res/values/strings.xml
Normal file → Executable file
|
@ -1,13 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="version" translatable="false">0.1.3-14.03.2015</string>
|
<string name="version" translatable="false">0.1.4-15.08.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="action_choose_ringsettings">Ringsettings</string>
|
<string name="action_choose_ringsettings">Ring-Settings</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="message_choose_ringsettings">Choose ringsettings for the rotors:</string>
|
<string name="action_send">Send</string>
|
||||||
|
<string name="send_to">Send to…</string>
|
||||||
|
<string name="message_choose_ringsettings">Choose ring-settings for the rotors:</string>
|
||||||
<string name="hint_enigma_type_here">Type here</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>
|
||||||
|
@ -15,13 +17,14 @@
|
||||||
<string name="hint_rotor2">Rotor 2</string>
|
<string name="hint_rotor2">Rotor 2</string>
|
||||||
<string name="hint_rotor3">Rotor 3</string>
|
<string name="hint_rotor3">Rotor 3</string>
|
||||||
<string name="hint_reflector">Reflector</string>
|
<string name="hint_reflector">Reflector</string>
|
||||||
<string name="hint_rotor1_position">Position Rotor 1</string>
|
<string name="hint_rotor1_position">Position\nRotor 1</string>
|
||||||
<string name="hint_rotor2_position">Position Rotor 2</string>
|
<string name="hint_rotor2_position">Position\nRotor 2</string>
|
||||||
<string name="hint_rotor3_position">Position Rotor 3</string>
|
<string name="hint_rotor3_position">Position\nRotor 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="error_no_text_to_send">Can\'t send empty text.</string>
|
||||||
<string name="title_ringsetting">Ringsettings</string>
|
<string name="title_ringsetting">Ringsettings</string>
|
||||||
<string name="dialog_positiv">OK</string>
|
<string name="dialog_positiv">OK</string>
|
||||||
<string name="dialog_negativ">Cancel</string>
|
<string name="dialog_negativ">Cancel</string>
|
||||||
|
@ -41,60 +44,4 @@
|
||||||
<item>B</item>
|
<item>B</item>
|
||||||
<item>C</item>
|
<item>C</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="rotor_positions">
|
|
||||||
<item>A</item>
|
|
||||||
<item>B</item>
|
|
||||||
<item>C</item>
|
|
||||||
<item>D</item>
|
|
||||||
<item>E</item>
|
|
||||||
<item>F</item>
|
|
||||||
<item>G</item>
|
|
||||||
<item>H</item>
|
|
||||||
<item>I</item>
|
|
||||||
<item>J</item>
|
|
||||||
<item>K</item>
|
|
||||||
<item>L</item>
|
|
||||||
<item>M</item>
|
|
||||||
<item>N</item>
|
|
||||||
<item>O</item>
|
|
||||||
<item>P</item>
|
|
||||||
<item>Q</item>
|
|
||||||
<item>R</item>
|
|
||||||
<item>S</item>
|
|
||||||
<item>T</item>
|
|
||||||
<item>U</item>
|
|
||||||
<item>V</item>
|
|
||||||
<item>W</item>
|
|
||||||
<item>X</item>
|
|
||||||
<item>Y</item>
|
|
||||||
<item>Z</item>
|
|
||||||
</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>
|
||||||
|
|
0
app/src/main/res/values/strings_activity_settings.xml
Normal file → Executable file
0
app/src/main/res/values/styles.xml
Normal file → Executable file
0
app/src/main/res/xml/pref_page.xml
Normal file → Executable file
4
build.gradle
Normal file → Executable file
|
@ -1,11 +1,11 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.1.0'
|
classpath 'com.android.tools.build:gradle:1.3.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<items version="2" >
|
|
||||||
|
|
||||||
<item
|
|
||||||
jar="/home/vanitas/Programmierung/androidstudio/EnigmAndroid/app/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/classes.jar"
|
|
||||||
jumboMode="false"
|
|
||||||
revision="20.0.0"
|
|
||||||
sha1="2c91c949a45a21cdecf26e03951e46c7beec9ad8">
|
|
||||||
<dex dex="/home/vanitas/Programmierung/androidstudio/EnigmAndroid/app/build/intermediates/pre-dexed/debug/classes-7bdf482936513a2d2b360d6a2f70cf21eca42762.jar" />
|
|
||||||
</item>
|
|
||||||
<item
|
|
||||||
jar="/home/vanitas/Programmierung/androidstudio/EnigmAndroid/app/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/libs/internal_impl-21.0.3.jar"
|
|
||||||
jumboMode="false"
|
|
||||||
revision="20.0.0"
|
|
||||||
sha1="01ec05bfbafcc07646ba813000bf2ef11742dd03">
|
|
||||||
<dex dex="/home/vanitas/Programmierung/androidstudio/EnigmAndroid/app/build/intermediates/pre-dexed/debug/internal_impl-21.0.3-63d8c8acc0e1cfdaed77f1165fcd87d053e4feed.jar" />
|
|
||||||
</item>
|
|
||||||
<item
|
|
||||||
jar="/media/Daten/android-sdk-linux/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3.jar"
|
|
||||||
jumboMode="false"
|
|
||||||
revision="20.0.0"
|
|
||||||
sha1="4b74cefe1f0c1b819e7260c8627a14674e37fd35">
|
|
||||||
<dex dex="/home/vanitas/Programmierung/androidstudio/EnigmAndroid/app/build/intermediates/pre-dexed/debug/support-annotations-21.0.3-fb7e977c35fa018b179241e5331c866d4bef0bb8.jar" />
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</items>
|
|
30
de.vanitasvitae.enigmandroid.txt
Normal file → Executable file
|
@ -1,15 +1,12 @@
|
||||||
Categories:Science & Education
|
Categories:Science & Education
|
||||||
License:GPLv2
|
License:GPLv2
|
||||||
Web Site: https://github.com/vanitasvitae/EnigmAndroid/wiki/EnigmAndroid
|
Web Site:https://github.com/vanitasvitae/EnigmAndroid/wiki/EnigmAndroid
|
||||||
Source Code: https://github.com/vanitasvitae/EnigmAndroid
|
Source Code:https://github.com/vanitasvitae/EnigmAndroid
|
||||||
Issue Tracker: https://github.com/vanitasvitae/EnigmAndroid/issues
|
Issue Tracker:https://github.com/vanitasvitae/EnigmAndroid/issues
|
||||||
Summary: Simulation of the Enigma Machine
|
Summary:Simulation of the Enigma Machine
|
||||||
Description:
|
Description:
|
||||||
This is a simulation of the famous Enigma cipher machine used in the twentieth century and especially in the Second World War.
|
Simulation of the famous Enigma cipher machine used in the Second World War.
|
||||||
The Enigma Machine was a typewriter-like machine with 26 keys and corresponding lamps. It used a set of mechanical Rotors to achieve polyalphabetic substitution.
|
The Enigma Machine was a typewriter-like machine, which used a set of mechanical Rotors to achieve polyalphabetic substitution.
|
||||||
|
|
||||||
The Enigma Machine was broken during the second world war by Marian Rejewski, Jerzy Różycki and Henryk Zygalski, who created a Machine called "Bomba" which could break the enigma code.
|
|
||||||
After Germany invaded Poland, the british mathematician Alan Turing (known for his work on theoretical computer science) succeeded in completely breaking the Enigma.
|
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Authentic Rotors
|
* Authentic Rotors
|
||||||
|
@ -17,7 +14,7 @@ Features:
|
||||||
* Double Step Anomaly
|
* Double Step Anomaly
|
||||||
* Working plugboard
|
* Working plugboard
|
||||||
|
|
||||||
More Information about the historical Enigma can be found on https://de.wikipedia.org/wiki/Enigma_%28Maschine%29
|
More Information about the historical Enigma can be found on [https://de.wikipedia.org/wiki/Enigma_%28Maschine%29 Wikipedia]
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,8 +36,13 @@ Build:0.1.2-24.02.2015-beta,8
|
||||||
subdir=app
|
subdir=app
|
||||||
gradle=yes
|
gradle=yes
|
||||||
|
|
||||||
Auto Update Mode:None
|
Build:0.1.3-14.03.2015-beta,9
|
||||||
Update Check Mode:Tags
|
commit=v0.1.3-14.03.2015-beta
|
||||||
Current Version:0.1.2-24.02.2015-beta
|
subdir=app
|
||||||
Current Version Code:8
|
gradle=yes
|
||||||
|
|
||||||
|
Auto Update Mode:Version v%v
|
||||||
|
Update Check Mode:Tags
|
||||||
|
Current Version:0.1.3-14.03.2015-beta
|
||||||
|
Current Version Code:9
|
||||||
|
|
||||||
|
|
0
gradle.properties
Normal file → Executable file
0
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file → Executable file
0
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file → Executable file
0
gradlew
vendored
Normal file → Executable file
0
gradlew.bat
vendored
Normal file → Executable file
|
@ -1,11 +0,0 @@
|
||||||
## This file is automatically generated by Android Studio.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must *NOT* be checked into Version Control Systems,
|
|
||||||
# as it contains information specific to your local configuration.
|
|
||||||
#
|
|
||||||
# Location of the SDK. This is only used by Gradle.
|
|
||||||
# For customization when using a Version Control System, please read the
|
|
||||||
# header note.
|
|
||||||
#Thu Mar 12 23:34:48 CET 2015
|
|
||||||
sdk.dir=/media/Daten/android-sdk-linux
|
|