mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-05-03 17:45:20 +08:00
!123 一些bug修复
* fix: 数据同步、数据迁移体验优化 * fix: des加密传输sql * fix: 修复达梦字段注释显示问题 * fix: mysql timestamp 字段类型导出ddl错误修复
This commit is contained in:
35
server/pkg/utils/cryptox/cryptox_test.go
Normal file
35
server/pkg/utils/cryptox/cryptox_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package cryptox
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAesEncrypt(t *testing.T) {
|
||||
key := []byte("eyJhbGciOiJIUzI1NiIsInR5")
|
||||
data := []byte("SELECT * FROM \"instruct\" OFFSET 0 LIMIT 25;")
|
||||
encrypt, err := AesEncrypt(data, key)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
toString := base64.StdEncoding.EncodeToString(encrypt)
|
||||
t.Log(toString)
|
||||
decrypt, err := AesDecrypt(encrypt, key)
|
||||
|
||||
t.Log(string(decrypt))
|
||||
}
|
||||
|
||||
func TestDes(t *testing.T) {
|
||||
key := []byte("eyJhbGciOiJIUzI1NiIsInR5")
|
||||
data := []byte("SELECT * FROM \"instruct\" OFFSET 0 LIMIT 25;")
|
||||
encrypt, err := DesEncrypt(data, key)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log("encrypt", encrypt)
|
||||
decrypt, err := DesDecrypt(encrypt, key)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log("decrypt", decrypt)
|
||||
}
|
||||
Reference in New Issue
Block a user