You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
368 B

  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package utils
  5. import (
  6. "crypto/md5"
  7. "encoding/hex"
  8. )
  9. // Encode string to md5 hex value
  10. func EncodeMd5(str string) string {
  11. m := md5.New()
  12. m.Write([]byte(str))
  13. return hex.EncodeToString(m.Sum(nil))
  14. }