| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package com.uas.platform.b2c;
- import com.uas.platform.core.util.Des;
- import org.junit.Test;
- public class DesTest {
- @Test
- public void test(){
- // 测试
- prindHexString("jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
- prindHexString("root");
- prindHexString("select111***");
- // 正式
- prindHexString("jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
- prindHexString("sa");
- prindHexString("Select123!#%*(");
- // 正式旧版
- prindHexString("jdbc:mysql://10.10.100.18:3306/mall_prod?characterEncoding=UTF-8");
- prindHexString("root");
- prindHexString("select");
- }
- /**
- * 打印加密后的字符串
- * @param s 明文
- */
- public void prindHexString(String s) {
- try {
- Des des = new Des();
- String key = "10101010";
- byte b[] = des.encrypt(s, key);
- System.out.println(des.toHexString(b));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
|