Archived Forum Post

Index of archived forum posts

Question:

Is HashAlgorithm case sensitive?

Nov 27 '14 at 08:55

On the page http://www.chilkatsoft.com/refdoc/xChilkatRsaRef.html for the function SignString (and other signing functions), one of the parameters is HashAlgorithm, which is a string parameter. It says that literal strings like "MD5", "SHA-1", etc are how you specify the hash algorithm. But is this case sensitive? Does "MD5" work just as well as "md5"? There's nothing on that webpage that says if it's case sensitive or not.


Answer

It is not case sensitive. Internally, Chilkat will take the string you pass, strip it of whitespace, strip it of non-alpha-numeric chars, convert it to lowercase, and then compare against a list of known hash algorithms. Therefore, "SHA-1" is internally converted to "sha1". Passing "SHA-1", "Sha_1", "Sha1", etc. are all the same..