Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Apr 3, 2023
1 parent 8fbae1e commit a3fb168
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ func Test_XtsPKCS5Padding(t *testing.T) {
cypt := FromString(data).
SetKey("1234567890abcdef1234567890abcdef").
Xts("Aes", 0x3333333333).
PKCS5Padding().
PaddingBy(PKCS5Padding).
Encrypt()
cyptStr := cypt.ToHexString()

assertError(cypt.Error(), "XtsPKCS5Padding-Encode")

cyptde := FromHexString(cyptStr).
SetKey("1234567890abcdef1234567890abcdef").
PKCS5Padding().
PaddingBy(PKCS5Padding).
Xts("Aes", 0x3333333333).
Decrypt()
cyptdeStr := cyptde.ToString()
Expand Down
18 changes: 9 additions & 9 deletions pkg/lakego-pkg/go-cryptobin/cryptobin/crypto/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func (this Cryptobin) Xts(cipher string, sectorNum uint64) Cryptobin {
func (this Cryptobin) MultipleBy(multiple Multiple, cfg ...map[string]any) Cryptobin {
this.multiple = multiple

if len(cfg) > 0 && len(cfg[0]) > 0{
for k, v := range cfg[0] {
this.config.Set(k, v)
for _, v := range cfg {
for kk, vv := range v {
this.config.Set(kk, vv)
}
}

Expand Down Expand Up @@ -236,9 +236,9 @@ func (this Cryptobin) CCM(nonce string, additional ...string) Cryptobin {
func (this Cryptobin) ModeBy(mode Mode, cfg ...map[string]any) Cryptobin {
this.mode = mode

if len(cfg) > 0 && len(cfg[0]) > 0{
for k, v := range cfg[0] {
this.config.Set(k, v)
for _, v := range cfg {
for kk, vv := range v {
this.config.Set(kk, vv)
}
}

Expand Down Expand Up @@ -325,9 +325,9 @@ func (this Cryptobin) PKCS1Padding(bt ...string) Cryptobin {
func (this Cryptobin) PaddingBy(padding Padding, cfg ...map[string]any) Cryptobin {
this.padding = padding

if len(cfg) > 0 && len(cfg[0]) > 0{
for k, v := range cfg[0] {
this.config.Set(k, v)
for _, v := range cfg {
for kk, vv := range v {
this.config.Set(kk, vv)
}
}

Expand Down

0 comments on commit a3fb168

Please sign in to comment.