您的位置:首页 > 其它

简单的加密解密方法

2013-10-17 08:46 381 查看
package com.homework;

/*
* 简单的加密与解密
*/
public class H2 {

public static void main(String[] args) {

H2 test = new H2();
String aa = test.jiami("1234123456");
String bb = test.jiemi(aa);
System.out.println("加密:"+aa);
System.out.println("源码:"+bb);
}

//加密方法
public String jiami(String str1){

str1 = str1.replace("1", "a");
str1 = str1.replace("2", "b");
str1 = str1.replace("3", "c");
str1 = str1.replace("4", "d");
return str1;
}

//解密方法
public String jiemi(String str2){

str2 = str2.replace("a","1");
str2 = str2.replace("b","2");
str2 = str2.replace("c","3");
str2 = str2.replace("d","4");
return str2;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: