VOOZH about

URL: https://www.geeksforgeeks.org/java/messagedigest-isequal-method-in-java-with-examples/

⇱ MessageDigest isEqual() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

MessageDigest isEqual() method in Java with Examples

Last Updated : 1 Feb, 2023

The isEqual() method of java.security.MessageDigest class is used to test if two message digest are equal or not.
 

Syntax:  

public static boolean
 isEqual(byte[] digesta, byte[] digestb)


Parameters: This method takes 2 byte arrays for comparison.
Return Value: This method provides the Boolean value, true if both digests are equal otherwise false.
 

Below are the examples to illustrate the isEqual() method:
Example 1: For Equal Digest Values  


Output: 
msd1 is equals to msd2

 

Example 2: For Unequal Digest Values 

Comment