aboutsummaryrefslogtreecommitdiff
path: root/internal/tool
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-04-11 01:25:19 +0800
committerGitHub <noreply@github.com>2020-04-11 01:25:19 +0800
commit62dda96159055ff9d485078f257445b964eb5220 (patch)
treea8bd161dc92c368bee0e6b58797e23278565cd8b /internal/tool
parent5753d4cb87388c247e91eaf3ce641d309a45e760 (diff)
access_token: migrate to GORM and add tests (#6086)
* access_token: migrate to GORM * Add tests * Fix tests * Fix test clock
Diffstat (limited to 'internal/tool')
-rw-r--r--internal/tool/tool.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/tool/tool.go b/internal/tool/tool.go
index 380f1069..eeed80e6 100644
--- a/internal/tool/tool.go
+++ b/internal/tool/tool.go
@@ -28,6 +28,7 @@ import (
)
// MD5Bytes encodes string to MD5 bytes.
+// TODO: Move to hashutil.MD5Bytes.
func MD5Bytes(str string) []byte {
m := md5.New()
_, _ = m.Write([]byte(str))
@@ -35,11 +36,13 @@ func MD5Bytes(str string) []byte {
}
// MD5 encodes string to MD5 hex value.
+// TODO: Move to hashutil.MD5.
func MD5(str string) string {
return hex.EncodeToString(MD5Bytes(str))
}
// SHA1 encodes string to SHA1 hex value.
+// TODO: Move to hashutil.SHA1.
func SHA1(str string) string {
h := sha1.New()
_, _ = h.Write([]byte(str))