forked from forgejo/forgejo
Merge utils to modules
This commit is contained in:
parent
a2a59f8ad1
commit
5a05d6633d
14 changed files with 30 additions and 30 deletions
17
modules/base/tool.go
Normal file
17
modules/base/tool.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
// Encode string to md5 hex value
|
||||
func EncodeMd5(str string) string {
|
||||
m := md5.New()
|
||||
m.Write([]byte(str))
|
||||
return hex.EncodeToString(m.Sum(nil))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue