Class AppSecurity
Inheritance
System.Object
AppSecurity
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: WebApplication.Framework
Assembly: WebApplication.dll
Syntax
public class AppSecurity
Methods
| Improve this Doc View SourceCompareByteArrays(Byte[], Byte[])
Declaration
public static bool CompareByteArrays(byte[] array1, byte[] array2)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | array1 | |
System.Byte[] | array2 |
Returns
Type | Description |
---|---|
System.Boolean |
ConvertToString(Byte[])
Declaration
public static string ConvertToString(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes |
Returns
Type | Description |
---|---|
System.String |
GenerateHash(String, String)
Generate a hash with the given salt.
To convert a hash to its string representation System.Convert.ToBase64String(System.Byte[]) and System.Convert.FromBase64String(System.String) to convert it back.
Declaration
public static byte[] GenerateHash(string data, string salt = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | data | The data to hash |
System.String | salt | The salt to apply |
Returns
Type | Description |
---|---|
System.Byte[] | The salted hash byte array |
GenerateSaltedHash(Byte[], Byte[])
Generate a salted hash with the given salt.
To convert text to byte arrays can be done using the method
Declaration
public static byte[] GenerateSaltedHash(byte[] data, byte[] salt = null)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to hash in bytes |
System.Byte[] | salt | The salt to apply in bytes |
Returns
Type | Description |
---|---|
System.Byte[] | The salted hash byte array |