如何获取文章的源码

运行一下代码 通过日志查看获取方法

public static void main(String[] args) {
        try {
            String str = "d41051ab3934a61c9230ce951313dd6ef17e0ad48ba89b2bd00dbfbdfe2585412c0b4b0a94d86bb417eaf27a0391be1c0f992a5519d2f3825d24fd128c92643e0793e1e4e64fbd10042742cf5d6eb8e7ecad5cb9406fd77e7ad3bbebe89b1c0857ad31da9272740fe86e89b3fc91931d";
            EncryptDES des = new EncryptDES();// 使用默认密钥
            byte[] decrypt = des.decryptCipher.doFinal(hexStr2ByteArr(str));
            System.out.println("获取文章源码的方法:" + new String(decrypt));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static String strDefaultKey = "sougit.com";

    private Cipher decryptCipher = null;

    public EncryptDES() throws Exception {
        this(strDefaultKey);
    }

    public EncryptDES(String strKey) throws Exception {
        Key key = getKey(strKey.getBytes());
        decryptCipher = Cipher.getInstance("DES");
        decryptCipher.init(Cipher.DECRYPT_MODE, key);
    }

    public static byte[] hexStr2ByteArr(String strIn) throws Exception {
        byte[] arrB = strIn.getBytes();
        int iLen = arrB.length;
        byte[] arrOut = new byte[iLen / 2];
        for (int i = 0; i < iLen; i = i + 2) {
            String strTmp = new String(arrB, i, 2);
            arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16);
        }
        return arrOut;
    }

    private Key getKey(byte[] arrBTmp) throws Exception {
        byte[] arrB = new byte[8];
        for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
            arrB[i] = arrBTmp[i];
        }
        Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");
        return key;
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值