Skip to content

Commit bfb7993

Browse files
committed
对 cloud getway漏洞判断漏洞增强
1 parent c9bbe0a commit bfb7993

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

cmd/commons/utils/base64.go

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package utils
2+
3+
import (
4+
"encoding/base64"
5+
log "github.com/sirupsen/logrus"
6+
)
7+
8+
// EncodeString Base64Encode encodes the given string to base64
9+
func EncodeString(str string) string {
10+
return base64.StdEncoding.EncodeToString([]byte(str))
11+
}
12+
13+
// DecodeString decode the base64 string return string
14+
func DecodeString(str string) string {
15+
decoded, err := base64.StdEncoding.DecodeString(str)
16+
if err != nil {
17+
log.Debug("Error decoding base64 string: ", err)
18+
return ""
19+
} else {
20+
return string(decoded)
21+
}
22+
}

0 commit comments

Comments
 (0)