summaryrefslogtreecommitdiffstats
path: root/modules/base/tool.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-11-12 06:48:50 -0500
committerUnknwon <joe2010xtmf@163.com>2014-11-12 06:48:50 -0500
commit8c9338a5377c60c84cdee1f5781b3de5933bb3b0 (patch)
tree57de36743bf8b9c8eaa0ff51172180b834354c4d /modules/base/tool.go
parent21b9d5fa1f4014b30619d221f5d665509d373147 (diff)
downloadgitea-8c9338a5377c60c84cdee1f5781b3de5933bb3b0.tar.gz
gitea-8c9338a5377c60c84cdee1f5781b3de5933bb3b0.zip
add personal access token panel #12
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r--modules/base/tool.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 4d3e1c7bfd..50f073a525 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -33,6 +33,13 @@ func EncodeMd5(str string) string {
return hex.EncodeToString(m.Sum(nil))
}
+// Encode string to sha1 hex value.
+func EncodeSha1(str string) string {
+ h := sha1.New()
+ h.Write([]byte(str))
+ return hex.EncodeToString(h.Sum(nil))
+}
+
func BasicAuthDecode(encoded string) (user string, name string, err error) {
var s []byte
s, err = base64.StdEncoding.DecodeString(encoded)