Package com.codingchili.core.security
Class ByteComparator
java.lang.Object
com.codingchili.core.security.ByteComparator
Compares byte arrays in constant-time.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ByteComparator
public ByteComparator()
-
-
Method Details
-
compare
Compares two strings in constant time.- Parameters:
first
- the first string.second
- the second string.- Returns:
- true if both Strings are of equal size and content.
-
compare
public static boolean compare(byte[] first, byte[] second)Compares two byte arrays in constant time.- Parameters:
first
- the first array.second
- the second array.- Returns:
- true if both arrays are of equal size and content.
-