https://github.com/thuoe/securityprogram
https://github.com/thuoe/securityprogram
des java security
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/thuoe/securityprogram
- Owner: thuoe
- Created: 2017-06-20T20:00:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-20T16:32:16.000Z (about 9 years ago)
- Last Synced: 2025-02-02T11:43:31.203Z (over 1 year ago)
- Topics: des, java, security
- Language: Java
- Size: 32.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
Awesome Lists containing this project
README
Please Compile and Run the Demonstrate.java file. Ensure all java files are together for successful compiling. HTML files for documentation can be found in the HTML directory. For writing to a text file, remove code on line 41 in Bob.java to view puzzles.txt file. This was used to prevent overflow of reading puzzles if user decides to run program more than once.
We were unsure as to whether to create a random 2 byte segment of the key randomly between the values 0-65536 or not. Instead we generated a random key with no bounds. Below was a possible method of the key generation with 65536 as a bound.
private byte[] generateRandom(){
byte[] zeroBytes = new byte[6];
Random random = new Random();
byte[] randomBytes = CryptoLib.smallIntToByteArray(random.nextInt(65536));
Arrays.fill(zeroBytes, (byte) 0);
System.arraycopy(randomBytes, 0, key, 0, 2);
System.arraycopy(zeroBytes, 0, key, 2, 6);
return key;
}