Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
duktig666 committed Jun 10, 2023
1 parent 144a5d4 commit 0ab9954
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,5 @@ linters:
- nestif
- nakedret
- nonamedreturns
- depguard
- tagalign
3 changes: 2 additions & 1 deletion cmd/keystorev4/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ var (

},
Run: func(cmd *cobra.Command, args []string) {
Run(cmd)
//Run(cmd)
},
}
)

// Run runs the command.
func Run(cmd *cobra.Command) (string, error) {

return "", nil
}
8 changes: 4 additions & 4 deletions common/cryptor/aes.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func AesEncryptByECBBase64(data, key string) string {
// 判断key长度
keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}}
if _, ok := keyLenMap[len(key)]; !ok {
panic("key长度必须是 16、24、32 其中一个")
panic("The key length must be 16, 24, 32 or one")
}
// 密钥和待加密数据转成[]byte
originByte := []byte(data)
Expand Down Expand Up @@ -75,7 +75,7 @@ func AesDecryptByECBBase64(data, key string) string {
// 判断key长度
keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}}
if _, ok := keyLenMap[len(key)]; !ok {
panic("key长度必须是 16、24、32 其中一个")
panic("The key length must be 16, 24, 32 or one")
}
// 反解密码base64
originByte, _ := base64.StdEncoding.DecodeString(data)
Expand Down Expand Up @@ -103,7 +103,7 @@ func AesEncryptByECB(data, key []byte) []byte {
// 判断key长度
keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}}
if _, ok := keyLenMap[len(key)]; !ok {
panic("key长度必须是 16、24、32 其中一个")
panic("The key length must be 16, 24, 32 or one")
}
// 密钥和待加密数据转成[]byte
originByte := data
Expand Down Expand Up @@ -133,7 +133,7 @@ func AesDecryptByECB(data, key []byte) []byte {
// 判断key长度
keyLenMap := map[int]struct{}{16: {}, 24: {}, 32: {}}
if _, ok := keyLenMap[len(key)]; !ok {
panic("key长度必须是 16、24、32 其中一个")
panic("The key length must be 16, 24, 32 or one")
}
// 反解密码base64
//originByte, _ := base64.StdEncoding.DecodeString(data)
Expand Down

0 comments on commit 0ab9954

Please sign in to comment.