diff --git a/Crypto/src/ROT13Test.java b/Crypto/Test/java/ROT13/ROT13Test.java
similarity index 97%
rename from Crypto/src/ROT13Test.java
rename to Crypto/Test/java/ROT13/ROT13Test.java
index 400c38b..b673652 100644
--- a/Crypto/src/ROT13Test.java
+++ b/Crypto/Test/java/ROT13/ROT13Test.java
@@ -1,3 +1,6 @@
+package ROT13;
+
+
import org.junit.Test;
import static org.junit.Assert.*;
@@ -23,7 +26,7 @@ public void rotateStringTest0() {
public void rotateStringTest1() {
// Given
String s1 = "ABCDEF";
- String s2 = "DEFABC";
+ String s2 = "DEFABC"; //DEFGHI
// When
ROT13 cipher = new ROT13();
diff --git a/Crypto/src/ROT13.java b/Crypto/src/ROT13.java
deleted file mode 100644
index 1c58731..0000000
--- a/Crypto/src/ROT13.java
+++ /dev/null
@@ -1,32 +0,0 @@
-import static java.lang.Character.isLowerCase;
-import static java.lang.Character.isUpperCase;
-import static java.lang.Character.toLowerCase;
-
-public class ROT13 {
-
- ROT13(Character cs, Character cf) {
- }
-
- ROT13() {
- }
-
-
- public String crypt(String text) throws UnsupportedOperationException {
-
- return "";
- }
-
- public String encrypt(String text) {
- return text;
- }
-
- public String decrypt(String text) {
- return text;
- }
-
- public static String rotate(String s, Character c) {
-
- return "";
- }
-
-}
diff --git a/Crypto/src/java/ROT13/PrintFile.java b/Crypto/src/java/ROT13/PrintFile.java
new file mode 100644
index 0000000..3b8792a
--- /dev/null
+++ b/Crypto/src/java/ROT13/PrintFile.java
@@ -0,0 +1,6 @@
+package ROT13;
+
+public class PrintFile {
+
+
+}
diff --git a/Crypto/src/java/ROT13/ROT13.java b/Crypto/src/java/ROT13/ROT13.java
new file mode 100644
index 0000000..5ac4442
--- /dev/null
+++ b/Crypto/src/java/ROT13/ROT13.java
@@ -0,0 +1,61 @@
+package ROT13;
+
+import java.util.Arrays;
+
+import static java.lang.Character.isLowerCase;
+import static java.lang.Character.isUpperCase;
+import static java.lang.Character.toLowerCase;
+
+public class ROT13 {
+ protected String startUpper;
+ protected String startLower;
+ protected String registerUpper;
+ protected String registerLower;
+ private Boolean symmetric = false;
+ private Integer shift;
+
+ ROT13(Character cs, Character cf) {
+ shift = cf - cs;
+ }
+
+ ROT13() {
+ this('a', 'm');
+ }
+
+
+ public String crypt(String text) throws UnsupportedOperationException {
+ //if (this.symmetric != true) throw new UnsupportedOperationException();
+
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < text.length(); i++) {
+ char c =text.charAt(i);
+ if (c >= 'a' && c <= 'm') c += 13;
+ else if (c >= 'A' && c <= 'M') c += 13;
+ else if (c >= 'n' && c <= 'z') c -= 13;
+ else if (c >= 'N' && c <= 'Z') c -= 13;
+ sb.append(c);
+ }
+ return sb.toString();
+ }
+
+
+ public String encrypt(String text)
+ {
+ return crypt(text);
+ }
+
+ public String decrypt(String text) {
+
+ return crypt(text);
+ }
+
+ public static String rotate(String s, Character c) {
+ Integer index = s.indexOf(c);
+ String front = s.substring(index);
+ String back = s.substring(0, index);
+ String joined = front + back;
+ return joined;
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 4021c2d..51a17fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,6 +7,20 @@
com.zipcodewilmington
SimpleCrypt
1.0-SNAPSHOT
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ junit
+ junit
+ 4.12
+ test
+
+