fix(aliyundriver):x-device-id error code (#3390)

* fix(aliyundriver):x-drvice-id error code

* fix(aliyunpan):session signature error

* fix typo

---------

Co-authored-by: Andy Hsu <i@nn.ci>
This commit is contained in:
foxxorcat
2023-02-14 14:11:07 +08:00
committed by GitHub
parent 22843ffc70
commit 46b2ed2507
7 changed files with 151 additions and 3 deletions

View File

@ -3,6 +3,7 @@ package utils
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"strings"
@ -14,6 +15,12 @@ func GetSHA1Encode(data string) string {
return hex.EncodeToString(h.Sum(nil))
}
func GetSHA256Encode(data string) string {
h := sha256.New()
h.Write([]byte(data))
return hex.EncodeToString(h.Sum(nil))
}
func GetMD5Encode(data string) string {
h := md5.New()
h.Write([]byte(data))