The output of this program is: SHA-1---->SHA-1 Message Digest from SUN, <initialized>
Digest value[B@13e8d89 java.security.NoSuchAlgorithmException: SHA256 MessageDigest not available at java.security.Security.getEngineClassName(Unknown Source) at java.security.Security.getEngineClassName(Unknown Source) at java.security.Security.getImpl(Unknown Source) at java.security.MessageDigest.getInstance(Unknown Source) at message.main(message.java:20)
The digest value is properly generated for the SHA-1 algorithm but it does not work for SHA-256 algorithm. I thought this to be a version problem. The version of JDK I was initially using was 1.4.1.
I found out that SHA-256 is only suported in JDK version 1.4.2 and later. I have tested the above code using JDK version 1.4.2 and JDK 1.5. The output is the same.
Can anyone please tell me where have I gone wrong?