/** * 简单加密或者解密 */ public class Encipherment { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { System.out.println("请输入一个英文字符串或解密字符串:(输入exit结束)"); String password = scanner.nextLine(); if (password.equalsIgnoreCase("exit")) { System.out.println("程序结束!"); return; } char[] array = password.toCharArray(); for (int i = 0; i < array.length; i++) { array[i] = (char) (array[i] ^ 20000); } System.out.println("加密或解密结果如下:"); System.out.println(new String(array)); } } }
普通的字符加密
最新推荐文章于 2024-07-21 15:10:19 发布