Skip to content

Commit 7174361

Browse files
docs(argon2): adds information on not being able to verify argon2d hashes.
Documents expectations from #80
1 parent e0a871d commit 7174361

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

argon2.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ package argon2
2323
import (
2424
"crypto/rand"
2525
"crypto/subtle"
26-
2726
"golang.org/x/crypto/argon2"
2827
)
2928

@@ -32,7 +31,7 @@ type Mode uint32
3231

3332
const (
3433
// modeArgon2d is added here for completeness, but is not exposed as the
35-
// crypto does not expose argon2d as an option.
34+
// x/crypto library does not expose argon2d as an option.
3635
//
3736
// modeArgon2d is faster and uses data-depending memory access,
3837
// which makes it highly resistant against GPU cracking attacks and
@@ -136,8 +135,8 @@ type Config struct {
136135
// default settings are based on RFC9106 recommendations.
137136
//
138137
// Refer:
139-
// * https://datatracker.ietf.org/doc/html/rfc9106#section-7.4
140-
// * https://datatracker.ietf.org/doc/html/rfc9106#section-4
138+
// - https://datatracker.ietf.org/doc/html/rfc9106#section-7.4
139+
// - https://datatracker.ietf.org/doc/html/rfc9106#section-4
141140
//
142141
// The memory constrained settings result in around 50ms of computation time
143142
// while using 64 MiB of memory during hashing. Tested on an Intel Core i7-7700
@@ -259,6 +258,12 @@ func (raw *Raw) Verify(pwd []byte) (bool, error) {
259258

260259
// VerifyEncoded returns true if `pwd` matches the encoded hash `encoded` and
261260
// otherwise false.
261+
//
262+
// Note: Only supports verifying `argon2i` and `argon2id` hashes. As `x/crypto`
263+
// doesn't expose the generation of `argon2d` hashing, we can't generate an
264+
// `argon2d` hash to verify the incoming password against.
265+
//
266+
// Refer: https://github.com/matthewhartstonge/argon2/issues/80#issuecomment-2679636640
262267
func VerifyEncoded(pwd []byte, encoded []byte) (bool, error) {
263268
r, err := Decode(encoded)
264269
if err != nil {

0 commit comments

Comments
 (0)