Επεξεργασία

Κοινή χρήση μέσω


Rfc2898DeriveBytes.Pbkdf2 Method

Definition

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)

Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs

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

Byte[]

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)

Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs

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

Byte[]

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)

Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs

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.

destination
Span<Byte>

The buffer to fill with a derived 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)

Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs

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

Byte[]

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)

Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs

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.

destination
Span<Byte>

The buffer to fill with a derived 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)

Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs
Source:
Rfc2898DeriveBytes.OneShot.cs

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

Byte[]

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