- import java.io.File;
- /**
- * 加密解密示例
- * @author ylf
- *
- */
- public class Test {
- public static void main(String[] args) {
- file();
- }
- //测试文件
- public static void file(){
- File f = new File("d:/db");
- f.delete();
- }
- //测试密码
- public static void pwd(){
- String aa = "azAZ09.";
- char tmp;
- char tt;
- String pwd = "";
- for(int i=0;i<aa.length();i++){
- tmp = aa.charAt(i);
- tt = (char)(tmp+10);
- pwd = pwd + tt;
- }
- System.out.println("以前的密码:"+aa);
- System.out.println("加密的密码:"+pwd);
- aa = "";
- for(int i=0;i<pwd.length();i++){
- tmp = pwd.charAt(i);
- tt = (char)(tmp-10);
- aa = aa+tt;
- }
- System.out.println("解密的密码:"+aa);
- }
- }
复制代码 |
|