This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedInputStream; | |
| import java.io.BufferedOutputStream; | |
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.util.Enumeration; | |
| import java.util.zip.ZipEntry; | |
| import java.util.zip.ZipFile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HeapSort { | |
| /*heapsort | |
| Description: Performs a heap sort on a given list | |
| Parameters: | |
| int[] list: array of integers to be sorted | |
| Pre: Initialized array | |
| Post: Sorted array | |
| Returns: Sorted array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ShellSort { | |
| /*shellsort | |
| Description: Performs a shell sort on a given list | |
| Parameters: | |
| int[] list: array of integers to be sorted | |
| int[] increments: array of bucket sizes | |
| Pre: Initialized array | |
| Post: Sorted array | |
| Returns: Sorted array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StraightInsertionSort { | |
| /*insertionsort | |
| Description: Performs a insertion sort on a given list | |
| Parameters: | |
| int[] list: array of integers to be sorted | |
| Pre: Initialized array | |
| Post: Sorted array | |
| Returns: Sorted array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int modinv(int a, int b) | |
| { | |
| int a0 = a; | |
| int b0 = b; | |
| int t0 = 0; | |
| int t = 1; | |
| int q = (int)Math.floor( a0 / b0 ); | |
| int r = a0 - (q * b0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| String ciphertext = "HSPAASLJPWOLYALEAJVBSKILHWYVISLTIBAUVAPMPAPZHZOPMAJPWOLY"; | |
| for(int shiftKey = 0; shiftKey < 26; shiftKey++) | |
| { | |
| String plainText = ""; | |
| for (int i=0; i<ciphertext.length(); i++) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.UnsupportedEncodingException; | |
| public class SubstitutionCipher { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.security.NoSuchAlgorithmException; | |
| import java.security.SecureRandom; | |
| import java.util.Vector; | |
| enum Photon { ZERO, ONE, UNDEFINED; }; | |
| class KeyBit { | |
| KeyBit(Photon setBit, String setPol){bit = setBit; polarization = setPol;} | |
| public Photon bit; | |
| public String polarization; | |
| public String toString() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.UnsupportedEncodingException; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.SecureRandom; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.math.BigInteger; | |
| import java.security.NoSuchAlgorithmException; | |
| import javax.crypto.Cipher; | |
| import javax.crypto.NoSuchPaddingException; | |
| import javax.crypto.spec.SecretKeySpec; | |
| public class AES { |