Documentation ¶
Overview ¶
contains two cryptographic functions for both storing and comparing passwords.
Index ¶
- func ClearDir(dir string) bool
- func CompareHash(digest []byte, password string) bool
- func ComparePwd(rawPwd, dbPwd string) bool
- func CopyDir(source string, dest string) (err error)
- func CopyFile(srcName, dstName string) (written int64, err error)
- func DeleteFile(path string) bool
- func Digest2(str string) string
- func Digest3(str string) string
- func FixFilename(filename string) string
- func FixUrlTime(t time.Time) time.Time
- func GenPwd(rawPwd string) string
- func GenerateHash(password string) ([]byte, error)
- func GetFileStrContent(path string) string
- func GetFilename(path string) string
- func GetFilesize(path string) int64
- func GetRandomFilePath(userId, uuid string) string
- func InArray(arr []string, str string) bool
- func InitEmail()
- func InitVd()
- func IsDirExists(path string) bool
- func IsEmail(email string) bool
- func IsFileExist(filename string) bool
- func IsGoodPwd(pwd string) (bool, string)
- func IsObjectId(id string) (ok bool)
- func IsUsername(username string) bool
- func IsValidTime(t time.Time) bool
- func L(i interface{})
- func LJ(i interface{})
- func ListDir(dir string) []string
- func Log(msg string, i ...interface{})
- func LogJ(i interface{})
- func LogW(msg string, i ...interface{})
- func Logf(msg string, i ...interface{})
- func Md5(s string) string
- func MkdirAll(dir string) bool
- func NewGuid() string
- func NewGuidWith(str string) string
- func PutFileStrContent(path, content string) bool
- func RandomPwd(num int) string
- func ReplaceAll(oldStr, pattern, newStr string) string
- func SendEmailOld(to, subject, body string) bool
- func SendToLeanoteOld(subject, title, body string)
- func SplitFilename(filename string) (baseName, ext string)
- func SubStringHTML(param string, length int, end string) string
- func SubStringHTMLToRaw(param string, length int) string
- func Substr(str string, start, length int) string
- func Substring(str string, start int) string
- func SubstringByte(str string, start int) string
- func ToLocalTime(t time.Time) time.Time
- func TransToGif(path string, maxWidth uint, afterDelete bool) (ok bool, transPath string)
- func TransferExt(path string, toExt string) string
- func Vd(name, value string) (ok bool, msg string)
- func Vds(m map[string]string) (ok bool, msg string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareHash ¶
CompareHash compares bcrypt password with a plaintext one. Returns true if passwords match and false if they do not.
func ComparePwd ¶
对比密码是否一致 因为之前密码是用md5加密的, 所以通过密码长度来判断 rawPwd 原始, 用户输入的密码
func DeleteFile ¶
func GenerateHash ¶
GenerateHash generates bcrypt hash from plaintext password
func GetFilename ¶
func GetRandomFilePath ¶
得到用户的随机文件路径 3位/userId/2位
func IsDirExists ¶
func IsFileExist ¶
func ReplaceAll ¶
截取含html的字符串
<div>
abcdef <p>xxxxxxxxxxx</p> <img src="" /> <div> abcdfef <p>aksdfjsld dfsadf --------------- 这里截断 </p> <p>xxxxxxxxxxxxxxx</p> abcdef </div>
</div> 那么只要在最后的html中添加</p></div></div>补全结束即可 思路: 1. 找到截断的位置 2. 去掉成对的标签 3. 去掉不要结束的标签 4. 补全标签
func SendEmailOld ¶
func SendToLeanoteOld ¶
func SendToLeanoteOld(subject, title, body string)
func TransToGif ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.