Class ConstantTimeUtils


  • public class ConstantTimeUtils
    extends java.lang.Object
    Array utilities.
    Version:
    2017-04-26
    Author:
    Vladimir Dzhuvinov
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean areEqual​(byte[] a, byte[] b)
      Checks the specified arrays for equality in constant time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • areEqual

        public static boolean areEqual​(byte[] a,
                                       byte[] b)
        Checks the specified arrays for equality in constant time. Intended to mitigate timing attacks.
        Parameters:
        a - The first array. Must not be null.
        b - The second array. Must not be null.
        Returns:
        true if the two arrays are equal, else false.