Connectivity Software User's Guide and Reference
CreateDeriveBytes Method



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Security.User Namespace > MemoryNameAndPasswordUserManager Class : CreateDeriveBytes Method
The password to hash.

The value of this parameter cannot be null (Nothing in Visual Basic).

The salt to use in hashing.

The value of this parameter cannot be null (Nothing in Visual Basic).

The algorithm ID to use for hashing.

The value of this parameter cannot be null (Nothing in Visual Basic).

The number of iterations for hashing.
Creates a System.Security.Cryptography.DeriveBytes instance for password hashing with the specified parameters.
Syntax
'Declaration
 
<JetBrains.Annotations.NotNullAttribute()>
Protected Overridable Function CreateDeriveBytes( _
   ByVal password As String, _
   ByVal salt() As Byte, _
   ByVal algorithmId As String, _
   ByVal iterations As Nullable(Of Integer) _
) As DeriveBytes
'Usage
 
Dim instance As MemoryNameAndPasswordUserManager
Dim password As String
Dim salt() As Byte
Dim algorithmId As String
Dim iterations As Nullable(Of Integer)
Dim value As DeriveBytes
 
value = instance.CreateDeriveBytes(password, salt, algorithmId, iterations)
[JetBrains.Annotations.NotNull()]
protected virtual DeriveBytes CreateDeriveBytes( 
   string password,
   byte[] salt,
   string algorithmId,
   Nullable<int> iterations
)
[JetBrains.Annotations.NotNull()]
protected:
virtual DeriveBytes^ CreateDeriveBytes( 
   String^ password,
   array<byte>^ salt,
   String^ algorithmId,
   Nullable<int> iterations
) 

Parameters

password
The password to hash.

The value of this parameter cannot be null (Nothing in Visual Basic).

salt
The salt to use in hashing.

The value of this parameter cannot be null (Nothing in Visual Basic).

algorithmId
The algorithm ID to use for hashing.

The value of this parameter cannot be null (Nothing in Visual Basic).

iterations
The number of iterations for hashing.

Return Value

A System.Security.Cryptography.DeriveBytes instance for password hashing.

This method never returns null (Nothing in Visual Basic).

Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

An invoked method is not supported at all, or is not supported with the parameters used to create the object.
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also