mirror of
				https://github.com/bolucat/Archive.git
				synced 2025-11-01 04:13:16 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			444 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			444 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package cmd
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 
 | |
| 	"github.com/spf13/cobra"
 | |
| 
 | |
| 	"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),
 | |
| 	Run: func(_ *cobra.Command, args []string) {
 | |
| 		pwd, err := users.HashPwd(args[0])
 | |
| 		checkErr(err)
 | |
| 		fmt.Println(pwd)
 | |
| 	},
 | |
| }
 | 
![github-action[bot]](/assets/img/avatar_default.png)