// e.g. A utility for password reset.
package main
import (
"fmt"
"os"
"git.awl.red/~neallred/recipes/user"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Expected to send a password for hasing")
os.Exit(1)
}
newPw := os.Args[1]
salt := user.GetToken(256)
hash := user.PwToHash(newPw, salt)
fmt.Printf("new salt: %s\n", salt)
fmt.Printf("new pw: %s\n", hash)
fmt.Printf("UPDATE user SET password = '%s', salt ='%s' WHERE username = <user>\n", hash, salt)
}