ihsan1

java cipher main class

Oct 21st, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package javaapplication2;
  2. import java.util.Scanner;
  3. public class cipher1 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         while(true){
  7.             System.out.print("text to encrypt: ");
  8.             String plain_text = scan.next();
  9.             System.out.print("encryption key(must be between 0 and 25): ");
  10.             int encryption_key = scan.nextInt();
  11.             System.out.println(abc.encrypt(plain_text,encryption_key));
  12.  
  13.             System.out.print("text to decrypt: ");
  14.             String cipher_text = scan.next();
  15.             System.out.print("encryption key(must be the same key used to encrypt the text): ");
  16.             int decryption_key = scan.nextInt();
  17.             System.out.println(abc.decrypt(cipher_text,decryption_key));
  18.         }
  19.  
  20.     }
  21.  
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment