DesTest.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.uas.platform.b2c;
  2. import com.uas.platform.core.util.Des;
  3. import org.junit.Test;
  4. public class DesTest {
  5. @Test
  6. public void test(){
  7. // 测试
  8. prindHexString("jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
  9. prindHexString("root");
  10. prindHexString("select111***");
  11. // 正式
  12. prindHexString("jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
  13. prindHexString("sa");
  14. prindHexString("Select123!#%*(");
  15. // 正式旧版
  16. prindHexString("jdbc:mysql://10.10.100.18:3306/mall_prod?characterEncoding=UTF-8");
  17. prindHexString("root");
  18. prindHexString("select");
  19. }
  20. /**
  21. * 打印加密后的字符串
  22. * @param s 明文
  23. */
  24. public void prindHexString(String s) {
  25. try {
  26. Des des = new Des();
  27. String key = "10101010";
  28. byte b[] = des.encrypt(s, key);
  29. System.out.println(des.toHexString(b));
  30. } catch (Exception e) {
  31. e.printStackTrace();
  32. }
  33. }
  34. }