السلام عليكم ورحمة الله تعالى وبركاته
مطلوب منا عمل ايمبليمينت لطريقة تشفير الكايسر وهي كود التشفير باقي قود الدي كريبشن
ياريت تساعدوني فيه وبارك الله فيكم
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cesars;
import java.util.Scanner;
public class caesar2 {
public static void main(String[] args) throws java.io.IOException {
// read input from console
System.out.println("Enter Plaintext: "); // prompt
Scanner consoleInput = new Scanner(System.in); // set up scanner
String input = consoleInput.nextLine(); // get line from console
// Note - if you want to read an integer from the console,
// use nextInt - see documentation for Scanner
char chars[] = input.toCharArray(); // break String up into chars
for (int i=0; i < chars.length; i++) // iterate through the chars
chars = Decrypt(chars); // update cipher to each char
String output = new String(chars); // convert back into a String
// write out String
System.out.println("CipherText: "+input);
System.out.println("PlainText: "+output);
}
public static char Encrypt (char x) // function to apply the cipher to a char
{
if(Character.isLetter(x))
{
if(Character.isICase(x))
{
int ascii_x = (int) x;
ascii_x -=97;
ascii_x = (ascii_x+3)%26;
return (char) (ascii_x + 97);
}
else{
int ascii_x = (int) x;
ascii_x -=65;
ascii_x = (ascii_x+3)%26;
return (char) (ascii_x + 65);
}
}else
return x;
}
nomj
}و ثاني شي مطلوب
Create software that can encrypt and decrypt using a 2 x 2 Hill cipher
وجزاكم الله كل خير