]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/pbkdf2: fix code example for Key
authorGusted <postmaster@gusted.xyz>
Sat, 8 Mar 2025 17:30:06 +0000 (17:30 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 10 Mar 2025 15:11:48 +0000 (08:11 -0700)
The type for password is not `[]byte` (as it was in golang.org/x/crypto/pbkdf2), it is `string`.

Change-Id: I914a81a500a6d93f994b587814f26285aef7b96d
GitHub-Last-Rev: 5ec752e0def59c1058c649b4543f296467691813
GitHub-Pull-Request: golang/go#72746
Reviewed-on: https://go-review.googlesource.com/c/go/+/656115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>

src/crypto/pbkdf2/pbkdf2.go

index dd5fc33f2120c335328291e232721642ba83d779..dff2e6cb355c5f4ae7aafd680c6f6eaa39c26b6a 100644 (file)
@@ -27,7 +27,7 @@ import (
 // can get a derived key for e.g. AES-256 (which needs a 32-byte key) by
 // doing:
 //
-//     dk := pbkdf2.Key(sha1.New, []byte("some password"), salt, 4096, 32)
+//     dk := pbkdf2.Key(sha1.New, "some password", salt, 4096, 32)
 //
 // Remember to get a good random salt. At least 8 bytes is recommended by the
 // RFC.