Class PasswordHash
Inheritance
System.Object
PasswordHash
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.Sys
Assembly: SIPSorcery.dll
Syntax
public class PasswordHash
Methods
| Improve this Doc View SourceGenerateSalt(Nullable<Int32>)
Generates a salt that can be used to generate a password hash. The salt is a combination of a block of bytes to represent the salt entropy and an integer that represents the iteration count to feed into the RFC289 algorithm used to derive the password hash. The iterations count is used to slow down the hash generating algorithm to mitigate brute force and rainbow table attacks.
Declaration
public static string GenerateSalt(int? explicitIterations = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | explicitIterations | The number of iterations used to derive the password bytes. Must be greater than the constant specifying the minimum iterations. |
Returns
Type | Description |
---|---|
System.String | A string it the format iterations.salt. |
Hash(String, String)
Generates the password hash from the password and salt. THe salt must be in the format iterations.salt.
Declaration
public static string Hash(string value, string salt)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to generate a hash for. |
System.String | salt | The salt (and iteration count) to generate the hash with. |
Returns
Type | Description |
---|---|
System.String | The hash. |