gowiki/pkg/db/helper.go
2018-09-04 23:15:47 +02:00

27 lines
391 B
Go

package db
import (
"golang.org/x/crypto/sha3"
"time"
)
func validatePassword(pw string) (b []byte) {
b = []byte(pw)
if len(pw) <= 56 {
return
}
hash := sha3.New384()
hash.Write(b)
b = hash.Sum(nil)
return
}
const timeFmt = "2006-01-02 15:04:05"
func now() string {
return time.Now().Format(timeFmt)
}
func created(username string) string {
return username + " " + now()
}