https://github.com/dmlloyd/openjdk
State the requirements the user needs in order to follow this tutorial.
Choose one of the following options:
on this occasion I will make a program to encrypt messages between two parties or more using the hill chipper method. the first party will write a message that will be converted into codes that cannot be understood because it has been encrypted, and then the second user will enter the password, the message can be read.
package encryptionmessage;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.swing.JOptionPane;
import javax.xml.bind.DatatypeConverter;
import java.lang.String;
public class sender {
public static void main(String[] args)throws IOException {
int Port =Integer.parseInt(JOptionPane.showInputDialog("please create password"));
String IP = JOptionPane.showInputDialog("Input Your IP");
Socket sock=new Socket("192.168.17",123456);
DataInputStream in= new DataInputStream(sock.getInputStream());
System.out.println(in.readUTF());
DataOutputStream out =new DataOutputStream(sock.getOutputStream());
out.writeUTF("message sending");
}
public static void main(String[] args) throws Exception {
String password = JOptionPane.showInputDialog("Input the key: ");
String message = JOptionPane.showInputDialog("Input Your message: ");
String encryptionMessage = encryptAES(messageText, keyEncryption);
JOptionPane.showMessageDialog(null,messageEncrypted);
}
private static byte[] convertToByte(String kunci) {
byte[] array_byte = new byte[20];
int i = 0;
while (i < kunci.length()) {
array_byte[i] = (byte) kunci.charAt(i);
i++; }
if (i < 20) {
while (i < 20) {
array_byte[i] = (byte) i;
i++;
} }
return array_byte;
}
sock.close();
}
}
package encryptionmessage;
public class sender {
int Port =Integer.parseInt(JOptionPane.showInputDialog("please create password"));
String IP = JOptionPane.showInputDialog("Input Your IP");
DataOutputStream out =new DataOutputStream(sock.getOutputStream());
out.writeUTF("message sending");
String message = JOptionPane.showInputDialog("Input Your message: ");
JOptionPane.showMessageDialog(null,messageEncrypted); private static byte[] convertToByte(String key) {
byte[] array_byte = new byte[20];
int i = 0;
while (i < kunci.length()) {
array_byte[i] = (byte) kunci.charAt(i);
i++; }
if (i < 20) {
while (i < 20) {
array_byte[i] = (byte) i;
i++;
} }
return array_byte;
}
package encryptionmessage;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.swing.JOptionPane;
import javax.xml.bind.DatatypeConverter;
import java.lang.String;
public class receiver {
public static void main(String[] args) throws IOException{
int Port =Integer.parseInt(JOptionPane.showInputDialog("Input the passord"));
String IP = JOptionPane.showInputDialog("Input Your IP");
ServerSocket serverSock=new ServerSocket(123456);
Socket Sock=serverSock .accept();
DataOutputStream out =new DataOutputStream(Sock.getOutputStream());
out.writeUTF("you have message");
DataInputStream in= new DataInputStream(Sock.getInputStream());
}
public static String decryptAES(String encryptedData, String encryptionKey)
throws Exception {
Cipher c = Cipher.getInstance("AES");
Key key = generateKey(encryptionMessage);
c.init(Cipher.DECRYPT_MODE, key);
byte[] decordedValue = DatatypeConverter
.parseBase64Binary(encryptedData);
byte[] decValue = c.doFinal(decordedValue);
String decryptedValue = new String(decValue);
return decryptedValue;
JOptionPane.showMessageDialog(null,encryptionMessage);
JOptionPane.showMessageDialog(null,message);
System.out.println(in.readUTF());
Sock.close();
}
}
public static String decryptAES(String encryptedData, String encryptionKey)
throws Exception {
Cipher c = Cipher.getInstance("AES");Key key = generateKey(encryptionMessage);
c.init(Cipher.DECRYPT_MODE, key);
byte[] decordedValue = DatatypeConverter
.parseBase64Binary(encryptedData);
byte[] decValue = c.doFinal(decordedValue);
String decryptedValue = new String(decValue);
return decryptedValue;
JOptionPane.showMessageDialog(null,encryptionMessage);
JOptionPane.showMessageDialog(null,message);
Include a list of related tutorials you have already shared on Utopian that make up a Course Curriculum, if applicable.
https://gist.github.com/jerryalexis/e691e1d18ea19014e2bfe43a4c75c30e