~eau/passwd

1d2cfa2c1321580c4dea2d59564f527d59e860b3 — eau 4 years ago 78c7bcd keyed-hash
SetSecret instead of NewSecret (confusing with New*())
2 files changed, 7 insertions(+), 1 deletions(-)

M cmd/pcrypt/main.go
M passwd.go
M cmd/pcrypt/main.go => cmd/pcrypt/main.go +6 -0
@@ 20,6 20,7 @@ func main() {
	bcryptFlag := flag.Bool("bcrypt", false, "use bcrypt derivation")
	checkFlag := flag.String("check", "", "hash to compare")
	maskedFlag := flag.Bool("mask", false, "generate masked hash")
	secretFlag := flag.String("secret", "", "use -secret <secret> as hash secret")

	flag.Parse()
	argv := flag.Args()


@@ 56,6 57,11 @@ func main() {
				if *maskedFlag {
					ph, err = passwd.NewMasked(profile)
				}

				if len(*secretFlag) > 0 {
					ph.SetSecret(*secretFlag)
				}

				if err != nil {
					panic(err)
				}

M passwd.go => passwd.go +1 -1
@@ 169,7 169,7 @@ func NewCustom(params interface{}) (*Profile, error) {
// NewSecret setup a secret associated with the profile currently in
// use
// following produced hashes, will use the new key'ed hashing algorithm
func (p *Profile) NewSecret(secret []byte) error {
func (p *Profile) SetSecret(secret []byte) error {
	switch v := p.params.(type) {
	case ScryptParams:
		v.secret = secret