加密
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
1.9 KiB

3 years ago
  1. package crypter
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. //func Test_DesEncrypt(t *testing.T) {
  7. // str := "123456789"
  8. // key := "DBPHW3K9"
  9. // ret, err := DesEncrypt(str, key)
  10. // fmt.Println(ret)
  11. // fmt.Println(err)
  12. //}
  13. //func Test_DesDecrypt(t *testing.T) {
  14. // str := "54291b8fa850aca3fb102569e569718797"
  15. // key := "DBPHW3K9"
  16. // ret, err := DesDecrypt(str, key)
  17. // fmt.Println("ret:", ret)
  18. // fmt.Println(err)
  19. //}
  20. //func Test_DesEn(t *testing.T) {
  21. // str := "rdesktop 10.0.66.21 -f -u username"
  22. // key := "2boscl0z"
  23. // en := DesEn(str, key)
  24. // fmt.Println(en)
  25. // fmt.Println(str)
  26. //}
  27. //func Test_DesDe(t *testing.T) {
  28. // str := "CD3A229D828AC38784064B2A1CCDEAD803D859DE60B20AE4FE81D27F59B64D39E3D09545EFDAFBB644C779872E1EB86B14742FE6A267D69AFD5888256F9D11D6D86EAECBCB2F0475E83432721DEF3BC60393C382F74B8BB7"
  29. // fmt.Println(str)
  30. // key := "LD13EY1R"
  31. // de := DesDe(str, key)
  32. // fmt.Println(" 数据 :", de)
  33. //}
  34. //func Test_TripleDesEncrypt(t *testing.T) {
  35. // // DogKey := "FP4FSSJ5"
  36. // // key := DogKey + "gi$01Lzy" + DogKey
  37. // kenEncode, err := TripleDesEncrypt("control-hdraydesktop")
  38. // t.Log(kenEncode)
  39. // t.Log(err)
  40. //}
  41. func Test_TripleDesDecrypt(t *testing.T) {
  42. str := "7fXpywgiF25K"
  43. DogKey := "FP4FSSJ5"
  44. key := DogKey + "gi$01Lzy" + DogKey
  45. de, err := TripleDesDecrypt(str, key) //, "8JTE41BA8JTE41BA8JTE41BA"
  46. fmt.Println(de, err)
  47. t.Log(de)
  48. de, err = TripleDesDecrypt("n7BCRSXtDUKv/RwRgu1s7j/FRg3v+TG9UFEqx7f+BPTuhl0Nm3GMRxbh/8JDxVH0zwJoQZOLUtnBkuchs2EaM9qNVLpIjF4fsoKMerlCbc1PY4mTKNdszzyTG31Nq/a0yrPrxInzsEBej8zrBLXBY0Ub7fO/aPQSxcEoTXK2/NmJI2r6y/LXfnmUeQ5/nBQuAOkP94mjVvyJi40wqGb0f7ae8Y3PoDONmM1JbGNVl0R0LMLQtLcqK914Ls8YQY3OZRBGmZtRQ5ZDbqyXCBCl6igsuZzmN+q8FyXjyzeAdWtlvbQtW1FROFNXXS3qExYx2a137l+szQGfWUpYvP9Egdx2YixxsIrZNEjQQVQzJkM=") //, "8JTE41BA8JTE41BA8JTE41BA"
  49. fmt.Println(de, err)
  50. }
  51. //func Test_Md5Password(t *testing.T) {
  52. // str := "123456"
  53. // one := Md5Password(str, "")
  54. // fmt.Println("md5 123456", one)
  55. //}