DesTest.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. // // 正式
  13. // prindHexString("jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
  14. // prindHexString("sa");
  15. // prindHexString("Select123!#%*(");
  16. //
  17. // // 正式旧版
  18. // prindHexString("jdbc:mysql://10.10.100.18:3306/mall_prod?characterEncoding=UTF-8");
  19. // prindHexString("root");
  20. // prindHexString("select");
  21. // 预部署
  22. // prindHexString("jdbc:mysql://10.10.100.200:3306/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true");
  23. // prindHexString("root");
  24. // prindHexString("select123***");
  25. }
  26. /**
  27. * 打印加密后的字符串
  28. * @param s 明文
  29. */
  30. public void prindHexString(String s) {
  31. try {
  32. Des des = new Des();
  33. String key = "10101010";
  34. byte b[] = des.encrypt(s, key);
  35. System.out.println(des.toHexString(b));
  36. } catch (Exception e) {
  37. e.printStackTrace();
  38. }
  39. }
  40. }