谁有java的 加密解密程序 给了就送分

qiuwei912 2004-08-24 08:58:38
谁有java的 加密解密程序 给了就送分
随便找一个 能用就成 要求不高
...全文
217 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
qiuwei912 2004-08-26
  • 打赏
  • 举报
回复
base64谁都可以解开 没有意义呀 有没有带钥匙的!!!
qudong078 2004-08-25
  • 打赏
  • 举报
回复
哈哈,不好意思,会错意了。
qudong078 2004-08-25
  • 打赏
  • 举报
回复


/**
* <p>Title: Base64</p>
* <p>Description: Base64编码的编码和解码类</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: ASPire</p>
* @author ZhangJi
* @version 1.0
*/

//@CheckItem@ REQ-Yulh-20030710 新增将InputStream流中的数据内容转化为Base64编码的方法。

import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
import java.io.InputStream;

public class Base64 {

/**
* 编码方法, 把一个字节数组编码为BASE64编码的字符串
* @param arrB 需要编码的字节数组
* @return BASE64编码的字符串
*/
public static String encode(byte[] arrB){
if (arrB == null){
return null;
}
return new BASE64Encoder().encode(arrB);
}

/**
* 解码方法, 把一个BASE64编码的字符串解码为编码前的字节数组
* @param in 需要解码的BASE64编码的字符串
* @return 解码后的字节数组, 若解码失败(该字符串不是BASE64编码)则返回null
*/
public static byte[] decode(String in) {
byte[] arrB = null;
try {
arrB = new BASE64Decoder().decodeBuffer(in);
}
catch (Exception ex) {
arrB = null;
}
return arrB;
}

/**
* 单元测试方法, 打印一个字符串在内存中的二进制值
* @param in 需要打印的字符串
*/
public static void printByte(String in){
byte[] arrB = in.getBytes();
for (int i = 0; i < arrB.length; i++) {
System.out.print(Integer.toHexString(arrB[i]) + " ");
}
System.out.println();
}

/**
* 编码方法, 把InputStream流中的数据内容编码为BASE64编码的字符串
* @param in 需要编码的字节数组
* @return BASE64编码的字符串
*/
public static String encode(InputStream in) {
if (in == null) {
return null;
}
byte[] read = new byte[64];
StringBuffer result = new StringBuffer("");
try {
int bytesRead = -1;
while ((bytesRead = in.read(read)) != -1) {
byte[] src = read;
if (bytesRead != 64) {
src = new byte[bytesRead];
for (int j = 0; j < bytesRead; j++) {
src[j] = read[j];
}
}
result.append(Base64.encode(src));
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return result.toString();
}




/**
* 单元测试方法, 分别打印一个字符串编码前, 编码后, 解码后的值
* @param args 参数数组, 不使用
*/
public static void main(String[] args) {
String strTmp = "13823194533";
System.out.println(strTmp);
printByte(strTmp);

strTmp = encode(strTmp.getBytes());
//strTmp = encode("".getBytes());
System.out.println(strTmp);
printByte(strTmp);

strTmp = new String(decode(strTmp));
System.out.println(strTmp);
printByte(strTmp);

strTmp = "333/";
strTmp = new String(decode(strTmp));
System.out.println(strTmp);
printByte(strTmp);



strTmp = "testhere";
strTmp = new String(decode(strTmp));
System.out.println(strTmp);
printByte(strTmp);
}
}
qiuwei912 2004-08-25
  • 打赏
  • 举报
回复
to:kevin115(kevin)我没收到任何留言呀??

to: yasusi(小康) 我要java写的
kevin115 2004-08-25
  • 打赏
  • 举报
回复
我有,这是我们项目实战时用的,发到你的留言里了
zflfaufa 2004-08-25
  • 打赏
  • 举报
回复
我有,加我的QQ:81832527,但是我在论坛上没有什么分,能不能给我加些分.
而且我这加密的程序,还是网上支付用的
yasusi 2004-08-25
  • 打赏
  • 举报
回复
你用blowfish class,这个类可以在网上下载。
然后用,Encrypt方法加密,Decrypt方法解密。
qiuwei912 2004-08-24
  • 打赏
  • 举报
回复
不好意思 我用eclipse 有没有现成的程序呀!!
vitamines 2004-08-24
  • 打赏
  • 举报
回复
是混淆器吧?
jb就有啊

81,092

社区成员

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

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