filebrowser/cmd/hash.go

26 lines
444 B
Go
Raw Permalink Normal View History

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