You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.1 KiB
69 lines
2.1 KiB
2 years ago
|
/*
|
||
|
* *
|
||
|
* * @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";
|
||
|
|
||
|
/**
|
||
|
* 加密
|
||
|
* @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));
|
||
|
}
|
||
|
}
|