Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Crypto/src/Main/rocks/zipcode/ROT13.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package rocks.zipcode;

import static java.lang.Character.isLowerCase;
import static java.lang.Character.isUpperCase;
import static java.lang.Character.toLowerCase;

public class ROT13 {
private int code;


public ROT13(Character cs, Character cf) {
code = cf - cs;
}

public ROT13() {
code = 0;
}

public String crypt(String text) throws UnsupportedOperationException {
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;
}
}
return text;
}

public String cryptFile() {
String sonnet = "sonnet18.txt";
sonnet = encrypt(sonnet);
return null ;
}


public String encrypt(String text) {
String encrypt = crypt(text);
return encrypt;
}

public String decrypt(String text) {
String decrypt = crypt(text);
return decrypt;
}

public static String rotate(String s, Character c) {
Integer index = s.indexOf(c);
return s.substring(index) + s.substring(0, index);
}

}
32 changes: 0 additions & 32 deletions Crypto/src/ROT13.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package rocks.zipcode;

import org.junit.Test;

import static org.junit.Assert.*;
Expand Down
16 changes: 16 additions & 0 deletions SimpleCrypt.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/Crypto/src/Main" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Crypto/src/Test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
<groupId>com.zipcodewilmington</groupId>
<artifactId>SimpleCrypt</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>


</project>