微信消息推送
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.

76 lines
2.1 KiB

3 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.push.helper;
/**
* @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) {
System.out.println(DesEncryptHelper.enCode("oeso-t5DIu2qpb0LJaKeJ06TRgzw", KEY));
System.out.println(DesEncryptHelper.deCode("19B20D16C09C4064DF385EDB1863A99B0C05CB8D5DA99C08B4C7AC6B6FAE028D89C90AAE3F5F397CDD177F25230726672B9441E369871608D74A40FD40F7EA3C967D1FBFC1ECCBA872A968C523FCB190A9B959AC822536151A508AA491ECF92B109C96E7B304C84284A45A61C476BA9BC833E2D178ADF27E4984AE325A602F6C08070D47695540349CB5F03072B586FB98009E083E8A20A4542BF29EA0BD120B", KEY));
}
}