/* * * * * @Project HM OA * * @Name DesEncrypt * * @Author 张剑峰 * * @Date 18-4-15 下午11:02 * * @Version v1.0.0 * * @Copyright @ 2017 云南道睿科技有限公司 All rights reserved. * */ package com.ynxbd.wx.utils; /** * @author Administrator * @version v1.0.0 * @date Oct 10, 2009 11:24:26 AM */ public class DesEncryptHelper { private static final String KEY = "2018ynhm8321"; public static void main(String[] args) { String s = enCode("oeso-t62kkoRwLVVkSkwmmjPfUXk"); String a= deCode("F42AC569AE5A2B2F7E7CFB00256B3C7EEB95AAAA7B749DDB5D5FA35644E3A67CC0C76C9A47F4B34747C4EE2635F332F395F251C48EEBC5C7C60BC3A091C98630A869BE7CED4B7BC0341EC83D6A1075C870EB48E943566CF9B76DE398E2A7B40601DA246EB85069091551C186A50ACEA013C6BCB9D804F5013F4A7AB333D1D079C3548A8D774ACB39"); System.out.println(a); } /** * 加密 * @param s 加密的字符串 * @return 加密后的字符 */ public static String enCode(String s) { return new DesHelper().stringEnc(s, KEY); } /** * 解密 * @param s 需要解密的字符串 * @return 解密后的内容 */ public static String deCode(String s) { return new DesHelper().stringDec(s, KEY); } /** * 自定义key的加密 * @param s * @param strKey 自定义的key * @return */ public static String enCode(String s, String strKey) { return new DesHelper().stringEnc(s, strKey); } /** * 自定义key的解密 * @param s * @param strKey 自定义的key * @return */ public static String deCode(String s, String strKey) { return new DesHelper().stringDec(s, strKey); } public static char[] enCodeChar(String s, String strKey) { return new DesHelper().charEnc(s, strKey); } public static char[] deCodeChar(String s, String strKey) { return new DesHelper().charDec(s, strKey); } // public static void main(String[] args) throws Exception { //// System.out.println(DesEncryptHelper.enCode("oeso-t5DIu2qpb0LJaKeJ06TRgzw", KEY)); // System.out.println(DesEncryptHelper.deCode("39E1BBDCA603241A017F6ABE802153ED94B2C5CD51DE268E63ECC53A8EE8241AF4D8E90E7C01D67D096AC60B3942817CBA8EEAF25B3BAA360566BE598C989659F6DC8A37E07FA5BD266A255BF3BE7256A82D9541864884310EA1F949CDAA9DEB3494C2EE12F16D7C27CF0E8A56BE1D6F9F90987EC1614A7F6C1541EDB5C496174054C25180DA77270F93E7A6564708BCA688FC09355CD0AC9605D6E07CBC7FA3", KEY)); // } }