hashpow

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Category: "Misc",
	Name:     "hashpow",
	Usage:    "Brute Hash Power of Work with md5/sha1",

	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "code",
			Aliases:  []string{"c"},
			Value:    "",
			Usage:    "Request code",
			Required: true,
		},
		&cli.IntFlag{
			Name:    "pos",
			Aliases: []string{"i"},
			Value:   0,
			Usage:   "Starting position of hash",
			Action: func(c *cli.Context, p int) error {
				if p < 0 || methodLength[c.String("method")] < p {
					return fmt.Errorf("invalid position")
				}
				return nil
			},
		},
		&cli.StringFlag{
			Name:    "prefix",
			Aliases: []string{"p"},
			Value:   "",
			Usage:   "Hash prefix",
		},
		&cli.StringFlag{
			Name:    "suffix",
			Aliases: []string{"s"},
			Value:   "",
			Usage:   "Hash suffix",
		},
		&cli.StringFlag{
			Name:    "method",
			Aliases: []string{"m"},
			Value:   "md5",
			Usage:   "Hash method: <sha1|md5>",
			Action: func(c *cli.Context, m string) error {
				if utils.SliceContains([]string{"md5", "sha1"}, m) {
					return nil
				}
				return fmt.Errorf("invalid method")
			},
		},
	},
	Action: func(c *cli.Context) error {
		r := HashPoW(c.String("code"), c.String("prefix"), c.String("suffix"), c.String("method"), c.Int("pos"))
		_, err := fmt.Println(r)
		return err
	},
}

Functions

func HashPoW

func HashPoW(code, prefix, suffix, method string, start int) string

HashPoW Brute Hash Power of Work with md5/sha1

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL