加密
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.

25 lines
628 B

  1. package crypter
  2. import (
  3. "testing"
  4. )
  5. func Test_TripleECBEncrypt(t *testing.T) {
  6. key := "7ejGP1WiZkgZ8VaIf6vBOBDFUnmByZiO" // 24字节的密钥
  7. data := "这是测试 This is test!=" // 明文
  8. d, err := TripleECBEncryptForHex(key, data)
  9. t.Log(d)
  10. t.Log(err)
  11. }
  12. func Test_TripleECBDecryptFromHex(t *testing.T) {
  13. key := "7ejGP1WiZkgZ8VaIf6vBOBDFUnmByZiO" // 24字节的密钥
  14. key = "99ef199ddd11ff93d6927f755fd2b108"
  15. msg := "0a7d96e2459dfa37cd13b8611acb26dd9adf31016bdb93da0d25d6a8041005e6"
  16. msg = "AD2A27C86D0E6C0499BEEFDD60675129"
  17. data, err := TripleECBDecryptFromHex(key, msg)
  18. t.Log(data)
  19. t.Log(err)
  20. }