md5_helper.go 486 B

12345678910111213141516171819202122
  1. /*
  2. * @Author: LinkLeong link@icewhale.com
  3. * @Date: 2022-06-14 14:33:25
  4. * @LastEditors: LinkLeong
  5. * @LastEditTime: 2022-06-14 14:33:49
  6. * @FilePath: /CasaOS/pkg/utils/encryption/md5_helper.go
  7. * @Description:
  8. * @Website: https://www.casaos.io
  9. * Copyright (c) 2022 by icewhale, All Rights Reserved.
  10. */
  11. package encryption
  12. import (
  13. "crypto/md5"
  14. "encoding/hex"
  15. )
  16. func GetMD5ByStr(str string) string {
  17. h := md5.New()
  18. h.Write([]byte(str))
  19. return hex.EncodeToString(h.Sum(nil))
  20. }