HashString Function

The HashString() function hashes the given value. It takes two (2) arguments and if any of them are NULL, a NULL is returned.

The syntax for HashString function is HashString( Value , [ Hash Algorithm ] ).
The valid [ Hash Algorithm ] values are 'md5', 'sha1', 'sha256' , 'sha384' and 'sha512' incorrect value returns first parameter value without hashing.

/* Following will produce 95B6159455685FB52EEE569F821F2FCC */ 
SELECT HashString('SQLDatabase.Net', 'md5') ;

/* Following will produce 0102458FB6413629F81A9BDC1686025C09A8C5A4E6384BA6408097EEAE955C08 */
SELECT HashString('SQLDatabase.Net', 'sha256') ;

It can be used to store uniqueness of value or calculate hash for the purpose of validity.