java工具2简单加密

package cn.jxsme.util.tool;
/*
* autho huangjin green eat 
*Oct 17, 2008
*/
public class CharMi {

public String encoding(String pwd) {


char chr [] = pwd.toCharArray();
for(int i =0;i<chr.length;i++)
{
int ascii = Integer.valueOf(chr[i]);
char newchr = (char)(ascii+5);
chr[i] = newchr;
}
String result = new String(chr);
return result;
}
public String decoding(String pwd)
{
char chr [] = pwd.toCharArray();
for(int i =0;i<chr.length;i++)
{
int ascii = Integer.valueOf(chr[i]);
char newchr = (char)(ascii-5);
chr[i] = newchr;
}
String result = new String(chr);
return result;
}
public CharMi() {
}

}

你可能感兴趣的:(java)