0 Replies Latest reply: Mar 6, 2012 8:33 AM by y360 c RSS

Problem with MessageDigest usage in MethodHashing

y360 c Newbie

In class MethodHashing there is code that uses MessageDigest as follows

 

MessageDigest.getInstance("SHA")

 

This works fine with Sun JCE where SHA is defined as an alias to the standard algorithm name SHA-1, but I need to use a different JCE provider that does not have the alias.

 

I quote from sun JCE docuemnt:

"Some providers may choose to also include alias names that also refer to the same algorithm. For example, the "SHA-1" algorithm might be referred to as "SHA1". Applications should use standard names instead of an alias, as not all providers may alias algorithm names in the same way."

 

For MessageDigest standard names are listed in:

http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#MessageDigest