-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pwschemes validation functions (#1956)
Implementation inspired by: * github.com/jsimonetti/pwscheme * github.com/alexedwards/argon2id RELEASE_NOTES=n/a Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
- Loading branch information
1 parent
c781015
commit 8bce2fc
Showing
7 changed files
with
329 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package argon2i | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestArgon2I(t *testing.T) { | ||
pw := "foobar" | ||
hash, err := Generate(pw, 0) | ||
require.NoError(t, err) | ||
|
||
t.Logf("PW: %s - Hash: %s", pw, hash) | ||
ok, err := Validate(pw, hash) | ||
require.NoError(t, err) | ||
assert.True(t, ok) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package argon2id | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestArgon2ID(t *testing.T) { | ||
pw := "foobar" | ||
hash, err := Generate(pw, 0) | ||
require.NoError(t, err) | ||
|
||
t.Logf("PW: %s - Hash: %s", pw, hash) | ||
ok, err := Validate(pw, hash) | ||
require.NoError(t, err) | ||
assert.True(t, ok) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.