Rfc2898DeriveBytes.Pbkdf2 Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Pbkdf2(Byte[], Byte[], Int32, HashAlgorithmName, Int32) |
Creates a PBKDF2 derived key from password bytes. |
Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32) |
Creates a PBKDF2 derived key from password bytes. |
Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName) |
Fills a buffer with a PBKDF2 derived key. |
Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32) |
Creates a PBKDF2 derived key from a password. |
Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName) |
Fills a buffer with a PBKDF2 derived key. |
Pbkdf2(String, Byte[], Int32, HashAlgorithmName, Int32) |
Creates a PBKDF2 derived key from a password. |
Pbkdf2(Byte[], Byte[], Int32, HashAlgorithmName, Int32)
Creates a PBKDF2 derived key from password bytes.
public:
static cli::array <System::Byte> ^ Pbkdf2(cli::array <System::Byte> ^ password, cli::array <System::Byte> ^ salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : byte[] * byte[] * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As Byte(), salt As Byte(), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()
Parameters
- password
- Byte[]
The password used to derive the key.
- salt
- Byte[]
The key salt used to derive the key.
- iterations
- Int32
The number of iterations for the operation.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm to use to derive the key.
- outputLength
- Int32
The size of key to derive.
Returns
A byte array containing the created PBKDF2 derived key.
Exceptions
password
or salt
is null
.
outputLength
is not zero or a positive value.
-or-
iterations
is not a positive value.
hashAlgorithm
has a Name that is empty or null
.
hashAlgorithm
is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512.
Applies to
Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)
Creates a PBKDF2 derived key from password bytes.
public:
static cli::array <System::Byte> ^ Pbkdf2(ReadOnlySpan<System::Byte> password, ReadOnlySpan<System::Byte> salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (ReadOnlySpan<byte> password, ReadOnlySpan<byte> salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : ReadOnlySpan<byte> * ReadOnlySpan<byte> * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As ReadOnlySpan(Of Byte), salt As ReadOnlySpan(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()
Parameters
- password
- ReadOnlySpan<Byte>
The password used to derive the key.
- salt
- ReadOnlySpan<Byte>
The key salt used to derive the key.
- iterations
- Int32
The number of iterations for the operation.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm to use to derive the key.
- outputLength
- Int32
The size of key to derive.
Returns
A byte array containing the created PBKDF2 derived key.
Exceptions
outputLength
is not zero or a positive value.
-or-
iterations
is not a positive value.
hashAlgorithm
has a Name that is empty or null
.
hashAlgorithm
is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512.
Applies to
Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)
Fills a buffer with a PBKDF2 derived key.
public:
static void Pbkdf2(ReadOnlySpan<System::Byte> password, ReadOnlySpan<System::Byte> salt, Span<System::Byte> destination, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public static void Pbkdf2 (ReadOnlySpan<byte> password, ReadOnlySpan<byte> salt, Span<byte> destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
static member Pbkdf2 : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * int * System.Security.Cryptography.HashAlgorithmName -> unit
Public Shared Sub Pbkdf2 (password As ReadOnlySpan(Of Byte), salt As ReadOnlySpan(Of Byte), destination As Span(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName)
Parameters
- password
- ReadOnlySpan<Byte>
The password used to derive the key.
- salt
- ReadOnlySpan<Byte>
The key salt used to derive the key.
- iterations
- Int32
The number of iterations for the operation.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm to use to derive the key.
Exceptions
iterations
is not a positive value.
hashAlgorithm
has a Name that is empty or null
.
hashAlgorithm
is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512.
Applies to
Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32)
Creates a PBKDF2 derived key from a password.
public:
static cli::array <System::Byte> ^ Pbkdf2(ReadOnlySpan<char> password, ReadOnlySpan<System::Byte> salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (ReadOnlySpan<char> password, ReadOnlySpan<byte> salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : ReadOnlySpan<char> * ReadOnlySpan<byte> * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As ReadOnlySpan(Of Char), salt As ReadOnlySpan(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()
Parameters
- password
- ReadOnlySpan<Char>
The password used to derive the key.
- salt
- ReadOnlySpan<Byte>
The key salt used to derive the key.
- iterations
- Int32
The number of iterations for the operation.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm to use to derive the key.
- outputLength
- Int32
The size of key to derive.
Returns
A byte array of length outputLength
that is filled with pseudo-random key bytes.
Exceptions
outputLength
is not zero or a positive value.
-or-
iterations
is not a positive value.
hashAlgorithm
has a Name that is empty or null
.
hashAlgorithm
is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512.
password
contains text that cannot be converted to UTF8.
Remarks
The password
will be converted to bytes using the UTF8 encoding. For
other encodings, convert the password string to bytes using the appropriate Encoding
and use Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32, HashAlgorithmName, Int32).
Applies to
Pbkdf2(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName)
Fills a buffer with a PBKDF2 derived key.
public:
static void Pbkdf2(ReadOnlySpan<char> password, ReadOnlySpan<System::Byte> salt, Span<System::Byte> destination, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public static void Pbkdf2 (ReadOnlySpan<char> password, ReadOnlySpan<byte> salt, Span<byte> destination, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
static member Pbkdf2 : ReadOnlySpan<char> * ReadOnlySpan<byte> * Span<byte> * int * System.Security.Cryptography.HashAlgorithmName -> unit
Public Shared Sub Pbkdf2 (password As ReadOnlySpan(Of Char), salt As ReadOnlySpan(Of Byte), destination As Span(Of Byte), iterations As Integer, hashAlgorithm As HashAlgorithmName)
Parameters
- password
- ReadOnlySpan<Char>
The password used to derive the key.
- salt
- ReadOnlySpan<Byte>
The key salt used to derive the key.
- iterations
- Int32
The number of iterations for the operation.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm to use to derive the key.
Exceptions
iterations
is not a positive value.
hashAlgorithm
has a Name that is empty or null
.
hashAlgorithm
is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512.
password
contains text that cannot be converted to UTF8.
Remarks
The password
will be converted to bytes using the UTF8 encoding. For
other encodings, convert the password string to bytes using the appropriate Encoding
and use Pbkdf2(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, HashAlgorithmName).
Applies to
Pbkdf2(String, Byte[], Int32, HashAlgorithmName, Int32)
Creates a PBKDF2 derived key from a password.
public:
static cli::array <System::Byte> ^ Pbkdf2(System::String ^ password, cli::array <System::Byte> ^ salt, int iterations, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, int outputLength);
public static byte[] Pbkdf2 (string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, int outputLength);
static member Pbkdf2 : string * byte[] * int * System.Security.Cryptography.HashAlgorithmName * int -> byte[]
Public Shared Function Pbkdf2 (password As String, salt As Byte(), iterations As Integer, hashAlgorithm As HashAlgorithmName, outputLength As Integer) As Byte()
Parameters
- password
- String
The password used to derive the key.
- salt
- Byte[]
The key salt used to derive the key.
- iterations
- Int32
The number of iterations for the operation.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm to use to derive the key.
- outputLength
- Int32
The size of key to derive.
Returns
A byte array of length outputLength
that is filled with pseudo-random key bytes.
Exceptions
password
or salt
is null
.
outputLength
is not zero or a positive value.
-or-
iterations
is not a positive value.
hashAlgorithm
has a Name that is empty or null
.
hashAlgorithm
is an unsupported hash algorithm. Supported algorithms are SHA1, SHA256, SHA384, and SHA512.
password
contains text that cannot be converted to UTF8.
Remarks
The password
will be converted to bytes using the UTF8 encoding. For
other encodings, convert the password string to bytes using the appropriate Encoding
and use Pbkdf2(Byte[], Byte[], Int32, HashAlgorithmName, Int32).
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기