~eau/passwd

1c0366ddfd88fd96177520da9c2c088302baf239 — eau 4 years ago 0068bf3
SetSecret renamed to SetKey as we're talking about Key'ed hashes
3 files changed, 4 insertions(+), 4 deletions(-)

M README.md
M passwd.go
M passwd_test.go
M README.md => README.md +1 -1
@@ 84,7 84,7 @@ key'd hashes try to guarantee that leaked password cannot be attacked offline.

We used the method described [here](https://bristolcrypto.blogspot.com/2015/01/password-hashing-according-to-facebook.html).

This requires you to **`<profile>.SetSecret()`** before call the **`Hash()`** or **`Compare()`** function.     
This requires you to **`<profile>.SetKey()`** before call the **`Hash()`** or **`Compare()`** function.     




M passwd.go => passwd.go +2 -2
@@ 226,9 226,9 @@ func NewCustom(params interface{}) (*Profile, error) {
	return nil, ErrUnsupported
}

// SetSecret setup a secret associated with the profile currently in
// SetKey setup a secret associated with the profile currently in
// use following produced hashes, will use the new key'ed hashing algorithm
func (p *Profile) SetSecret(secret []byte) error {
func (p *Profile) SetKey(secret []byte) error {
	switch v := p.params.(type) {
	case *ScryptParams:
		v.secret = secret

M passwd_test.go => passwd_test.go +1 -1
@@ 289,7 289,7 @@ func TestCompat(t *testing.T) {
		}

		if len(test.secret) > 0 {
			myprofile.SetSecret(test.secret)
			myprofile.SetKey(test.secret)
		}
		if err != nil {
			t.Fatalf("test #%d: profile: %d err: %v vs expected: %v\n", i, myprofile, err, test.want)