![]() |
VOOZH | about |
The setMessageDigest() method of java.security.DigestOutputStream class used to assign the specified MessageDigest to DigestOutputStream object.
Syntax:
public void setMessageDigest(MessageDigest digest)
Return Value: This method has nothing to return.
Note: All the programs in this article won’t run on online IDE as no ‘name’ file exists. You can check this code on Java compiler on your system. To check this code, create a file ‘name’ on your system.
Below are the examples to illustrate the setMessageDigest() method:
Example 1:
MessageDigest before assigning : MD5 Message Digest from SUN, MessageDigest after assigning : SHA-1 Message Digest from SUN,
Example 2:
MessageDigest before assigning : SHA-1 Message Digest from SUN, MessageDigest after assigning : MD5 Message Digest from SUN,