diff options
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r-- | modules/base/tool.go | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go index cb9b996142..86606c8bee 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -6,13 +6,11 @@ package base import ( "crypto/md5" - "crypto/rand" "crypto/sha1" "crypto/sha256" "encoding/base64" "encoding/hex" "fmt" - "io" "net/http" "net/url" "os" @@ -75,18 +73,6 @@ func BasicAuthEncode(username, password string) string { return base64.StdEncoding.EncodeToString([]byte(username + ":" + password)) } -// GetRandomBytesAsBase64 generates a random base64 string from n bytes -func GetRandomBytesAsBase64(n int) string { - bytes := make([]byte, 32) - _, err := io.ReadFull(rand.Reader, bytes) - - if err != nil { - log.Fatal("Error reading random bytes: %v", err) - } - - return base64.RawURLEncoding.EncodeToString(bytes) -} - // VerifyTimeLimitCode verify time limit code func VerifyTimeLimitCode(data string, minutes int, code string) bool { if len(code) <= 18 { |