Skip to content

Commit

Permalink
优化更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Apr 8, 2022
1 parent 07d75d9 commit 021eac2
Show file tree
Hide file tree
Showing 57 changed files with 1,738 additions and 331 deletions.
17 changes: 17 additions & 0 deletions app/example/controller/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (

"github.com/deatil/go-hash/hash"
"github.com/deatil/go-datebin/datebin"
"github.com/deatil/go-encoding/encoding"
"github.com/deatil/go-pipeline/pipeline"
"github.com/deatil/go-exception/exception"
"github.com/deatil/go-cryptobin/cryptobin"
"github.com/deatil/lakego-filesystem/filesystem"

"github.com/deatil/lakego-doak/lakego/str"
"github.com/deatil/lakego-doak/lakego/snowflake"
"github.com/deatil/lakego-doak/lakego/facade/sign"

"github.com/deatil/lakego-doak-admin/admin/support/controller"
)
Expand Down Expand Up @@ -166,6 +168,16 @@ func (this *Data) Error(ctx *gin.Context) {
// 签名
hashData := hash.FromString("123").MD5_16().ToString()

// 编码
encodeStr := encoding.FromString("test-data").ToBase85String()
encodeStr2 := encoding.FromBase85String("FCfN8/S&:3@/p9-").ToString()

// 签名
signData := sign.Sign("md5").
WithData("test", "测试测试").
WithAppID("API123456").
GetSignMap()

this.SuccessWithData(ctx, "Error 测试", gin.H{
"error": data,
"data2": data2,
Expand All @@ -187,6 +199,11 @@ func (this *Data) Error(ctx *gin.Context) {
"rsaPubKey": rsaPubKey,

"hashData": hashData,

"encodeStr": encodeStr,
"encodeStr2": encodeStr2,

"signData": signData,
})
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.18
replace (
app => ./app
github.com/deatil/go-goch => ./pkg/lakego-pkg/go-goch
github.com/deatil/go-sign => ./pkg/lakego-pkg/go-sign
github.com/deatil/go-hash => ./pkg/lakego-pkg/go-hash
github.com/deatil/go-datebin => ./pkg/lakego-pkg/go-datebin
github.com/deatil/go-encoding => ./pkg/lakego-pkg/go-encoding
Expand All @@ -13,6 +14,7 @@ replace (
github.com/deatil/go-collection => ./pkg/lakego-pkg/go-collection
github.com/deatil/go-filesystem => ./pkg/lakego-pkg/go-filesystem
github.com/deatil/go-pipeline => ./pkg/lakego-pkg/go-pipeline
github.com/deatil/lakego-jwt => ./pkg/lakego-pkg/lakego-jwt
github.com/deatil/lakego-filesystem => ./pkg/lakego-pkg/lakego-filesystem
github.com/deatil/lakego-doak => ./pkg/lakego-pkg/lakego-doak
github.com/deatil/lakego-doak-action-log => ./pkg/lakego-app/doak-action-log
Expand Down
2 changes: 2 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ use (
./app
./pkg/lakego-pkg/go-hash
./pkg/lakego-pkg/go-goch
./pkg/lakego-pkg/go-sign
./pkg/lakego-pkg/go-pipeline
./pkg/lakego-pkg/go-exception
./pkg/lakego-pkg/go-collection
./pkg/lakego-pkg/go-cryptobin
./pkg/lakego-pkg/go-datebin
./pkg/lakego-pkg/go-encoding
./pkg/lakego-pkg/go-filesystem
./pkg/lakego-pkg/lakego-jwt
./pkg/lakego-pkg/lakego-filesystem
./pkg/lakego-pkg/lakego-doak
./pkg/lakego-app/doak-action-log
Expand Down
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.1.0 h1:XUgk2Ex5veyVFVeLm0xhusUTQybEbexJXrvPNOKkSY0=
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ=
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
42 changes: 41 additions & 1 deletion pkg/lakego-pkg/go-cryptobin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package main
import (
"fmt"

"github.com/deatil/go-cryptobin"
"github.com/deatil/go-cryptobin/cryptobin"
)

func main() {
Expand Down Expand Up @@ -225,6 +225,46 @@ func main() {
Decrypt().
ToString()

// =====

// RC4 加密测试
cypt := cryptobin.
FromString("test-pass").
SetKey("dfertf12dfertf12dfertf12").
RC4().
Encrypt().
ToHexString()
cyptde := cryptobin.
FromHexString("4308d5f24be9195317").
SetKey("dfertf12dfertf12dfertf12").
RC4().
Decrypt().
ToString()

// =====

// Chacha20 加密测试
cypt := cryptobin.
FromString("test-pass").
SetKey("dfertf12dfertf12dfertf12ghy6yhtg").
Chacha20([]byte("fgr5tfgr5rtr")).
Encrypt().
ToHexString()
cyptde := cryptobin.
FromHexString("a87757b7196994e818").
SetKey("dfertf12dfertf12dfertf12ghy6yhtg").
Chacha20([]byte("fgr5tfgr5rtr")).
Decrypt().
ToString()

// =====

// Asn1 编码
var p string
encodeStr := encoding.ForAsn1("test-data").ToBase64String()
encoding.FromBase64String("Ewl0ZXN0LWRhdGE=").Asn1To(&p)
encodeStr2 := p

}

~~~
Expand Down
Loading

0 comments on commit 021eac2

Please sign in to comment.