日期:2014-05-18  浏览次数:20738 次

什么样的加密算法能加密又能还原密文
什么样的加密算法能加密又能还原密文

目前有现成的可用不?不需要自己去写吧

------解决方案--------------------
你找个有密钥的就行了啊。
------解决方案--------------------
最简单的base64
------解决方案--------------------
/** 
     * BASE64解密 
     *  
     * @param key 
     * @return 
     * @throws Exception 
     */  
    public static byte[] decryptBASE64(String key) throws Exception {  
        return (new BASE64Decoder()).decodeBuffer(key);  
    }  
  
    /** 
     * BASE64加密 
     *  
     * @param key 
     * @return 
     * @throws Exception 
     */  
    public static String encryptBASE64(byte[] key) throws Exception {  
        return (new BASE64Encoder()).encodeBuffer(key);  
    }  
------解决方案--------------------
http://blog.csdn.net/withiter/article/details/7298815




import java.security.Key;
import java.security.Security;

import javax.crypto.Cipher;

/**
 * DES加密和解密工具,可以对字符串进行加密和解密操作 。
 */
public class DesUtils {

    /** 字符串默认键值 */
    private static String strDefaultKey = "national";

    /** 加密工具 */
    private Cipher encryptCipher = null;

    /** 解密工具 */
    private Cipher decryptCipher = null;

    /**
     * 将byte数组转换为表示16进制值的字符串, 如:byte[]{8,18}转换为:0813, 和public static byte[]
     * hexStr2ByteArr(String strIn) 互为可逆的转换过程
     * 
     * @param arrB
     *            需要转换的byte数组
     * @return 转换后的字符串
     * @throws Exception
     *             本方法不处理任何异常,所有异常全部抛出
     */
    public static String byteArr2HexStr(byte[] arrB) throws Exception {
        int iLen = arrB.length;
  &