Sage Modeling and Simulation Library

Crypto..::..ComputeHash Method

Generates a hash for the given plain text value and returns a base64-encoded result. Before the hash is computed, a random salt is generated and appended to the plain text. This salt is stored at the end of the hash value, so it can be used later for hash verification.

Namespace:  Highpoint.Sage.Utility
Assembly:  Sage4 (in Sage4.dll)


public static string ComputeHash(
	string plainText,
	string hashAlgorithm,
	byte[] saltBytes


Type: String
Plaintext value to be hashed. The function does not check whether this parameter is null.
Type: String
Name of the hash algorithm. Allowed values are: "MD5", "SHA1", "SHA256", "SHA384", and "SHA512" (if any other value is specified MD5 hashing algorithm will be used). This value is case-insensitive.
Type: array<Byte>[]()[][]
Salt bytes. This parameter can be null, in which case a random salt value will be generated.

Return Value

Hash value formatted as a base64-encoded string.