In part one I discussed computing the hash value using the MD5 hash algorithm for an email address, in this post I am going to discuss using other hash algorithms available in the HashAlgorithm Class to compute the value.
The available hash algorithms are MD5, RIPEMD160, SHA1, SHA256, SHA384 and SHA512 therefore in the advanced function we will set a parameter value which validates the input provided. By default, the hash algorithm of MD5 will be used unless specified.
The script block to compute the hash value does not differ from the example provided in the previous example which uses the StringBuilder Class .NET Framework object, other than we pass the hash algorithm parameter to the HashAlgorithm Class to compute the value.
Now be invoking the function and specifying a hash algorithm to compute the hash value I am able to use the default MD5 in the first instance and then each of the hash algorithms specified in the class.
In the final part, I will look at using the Blowfish-based hashing algorithm to compute the hash value and have an available advanced function and also provide the ability to specify not only an email address but a string value to compute the hash value.