Files
filebrowser/cmd/hash.go
T

26 lines
446 B
Go
Raw Normal View History

2019-01-06 17:53:47 +00:00
package cmd
import (
"fmt"
"github.com/spf13/cobra"
2020-06-01 01:12:36 +02:00
"github.com/filebrowser/filebrowser/v2/users"
2019-01-06 17:53:47 +00:00
)
func init() {
rootCmd.AddCommand(hashCmd)
}
var hashCmd = &cobra.Command{
2019-02-15 12:54:44 +01:00
Use: "hash <password>",
Short: "Hashes a password",
Long: `Hashes a password using bcrypt algorithm.`,
Args: cobra.ExactArgs(1),
2019-01-06 17:53:47 +00:00
Run: func(cmd *cobra.Command, args []string) {
pwd, err := users.HashPwd(args[0])
checkErr(err)
fmt.Println(pwd)
},
}