Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-common
Commits
4cfd291e
Commit
4cfd291e
authored
Jun 25, 2023
by
hujiebin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:价格xxtea
parent
4cf89769
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
go.mod
go.mod
+1
-0
go.sum
go.sum
+2
-0
encrypt.go
utils/encrypt.go
+8
-0
No files found.
go.mod
View file @
4cfd291e
...
...
@@ -58,6 +58,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.479 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ims v1.0.479 // indirect
github.com/tencentyun/tls-sig-api-v2-golang v1.0.0 // indirect
github.com/xxtea/xxtea-go v1.0.0 // indirect
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.6 // indirect
...
...
go.sum
View file @
4cfd291e
...
...
@@ -228,6 +228,8 @@ github.com/tencentyun/tls-sig-api-v2-golang v1.1.0 h1:dWbCuoTaRWvcS/RWW/8RIAvLRA
github.com/tencentyun/tls-sig-api-v2-golang v1.1.0/go.mod h1:D/i1nQrP1hSXxxz+SAmjaprAwH3EhYaktJG6BObWnFE=
github.com/tencentyun/tls-sig-api-v2-golang v1.3.0 h1:mW4onVqOP6MqkJtTay74Tch6NvjwQRXeCuhUC/p6YYk=
github.com/tencentyun/tls-sig-api-v2-golang v1.3.0/go.mod h1:0L1MSijyEq6a74xZ02h0qKfN8y6RcvDiNabIZWXereE=
github.com/xxtea/xxtea-go v1.0.0 h1:HUeElH97FsZS/+l+iroj0lhosKe47VMtdIL2Lz3MeFg=
github.com/xxtea/xxtea-go v1.0.0/go.mod h1:2uvuCBt0VXxijrX5ieiAeeNT2+2MIsrs1DI9iXz7OOQ=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
...
...
utils/encrypt.go
View file @
4cfd291e
...
...
@@ -7,6 +7,7 @@ import (
"encoding/base64"
"encoding/json"
"errors"
"github.com/xxtea/xxtea-go/xxtea"
)
func
EncryptionData
(
data
interface
{},
aeskey
[]
byte
)
string
{
...
...
@@ -83,3 +84,10 @@ func pKCS5UnPadding(origData []byte) []byte {
unpadding
:=
int
(
origData
[
length
-
1
])
return
origData
[
:
(
length
-
unpadding
)]
}
func
EncryptionData2
(
data
interface
{},
key
[]
byte
)
string
{
str
,
_
:=
json
.
Marshal
(
data
)
encrypted
:=
xxtea
.
Encrypt
(
str
,
key
)
base64Str
:=
base64
.
StdEncoding
.
EncodeToString
(
encrypted
)
return
string
(
base64Str
)
}
hujiebin
@hujiebin
mentioned in commit
3e071612
·
Jun 25, 2023
mentioned in commit
3e071612
mentioned in commit 3e0716123a9f9b529f157d5f37a899500810ed5c
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment