关于加密还原问题,急待!!!

opet_zhu 2010-05-14 11:22:11
public static String encrypt(String password)
{
char c1[] = password.toCharArray();

for (int i = 0; i < password.length(); i++)
{
c1[i] = (char) (i + c1[i]);
}

return new String(c1);
}

public static void main(String[] args) {
System.out.println(encrypt("opet123456"));
// 输出为:oqgw579;=?

}

现在我想写个函数,传入"oqgw579;=?" 输出为:opet123456
请大侠们帮我看看。写个函数。谢谢
...全文
31 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
opet_zhu 2010-05-14
  • 打赏
  • 举报
回复
嘿嘿,急呀,怕你没看到
RHuniSoft 2010-05-14
  • 打赏
  • 举报
回复
public class solve{
public static String encrypt(String password){
char c1[] = password.toCharArray();
for (int i = 0; i < password.length(); i++)
c1[i] = (char) (i + c1[i]);
return new String(c1);
}
public static String turnback(String key){
char c1[] = key.toCharArray();
for (int i = 0; i < key.length(); i++)
c1[i] = (char) (c1[i]-i);
return new String(c1);
}
public static void main(String[] args) {
String temp=new String();
temp=encrypt("jhmjfgfb7678*(^A&*");
System.out.println(temp);
System.out.println(turnback(temp));
}
}
mickey_uuu 2010-05-14
  • 打赏
  • 举报
回复
不用一个问题在三个版都发吧

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧