Class HpackUtil


  • final class HpackUtil
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  HpackUtil.IndexType  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private HpackUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static int equalsConstantTime​(java.lang.CharSequence s1, java.lang.CharSequence s2)
      Compare two CharSequence objects without leaking timing information.
      (package private) static boolean equalsVariableTime​(java.lang.CharSequence s1, java.lang.CharSequence s2)
      Compare two CharSequences.
      • Methods inherited from class java.lang.Object

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

      • HUFFMAN_CODES

        static final int[] HUFFMAN_CODES
      • HUFFMAN_CODE_LENGTHS

        static final byte[] HUFFMAN_CODE_LENGTHS
    • Constructor Detail

      • HpackUtil

        private HpackUtil()
    • Method Detail

      • equalsConstantTime

        static int equalsConstantTime​(java.lang.CharSequence s1,
                                      java.lang.CharSequence s2)
        Compare two CharSequence objects without leaking timing information.

        The int return type is intentional and is designed to allow cascading of constant time operations:

             String s1 = "foo";
             String s2 = "foo";
             String s3 = "foo";
             String s4 = "goo";
             boolean equals = (equalsConstantTime(s1, s2) & equalsConstantTime(s3, s4)) != 0;
         
        Parameters:
        s1 - the first value.
        s2 - the second value.
        Returns:
        0 if not equal. 1 if equal.
      • equalsVariableTime

        static boolean equalsVariableTime​(java.lang.CharSequence s1,
                                          java.lang.CharSequence s2)
        Compare two CharSequences.
        Parameters:
        s1 - the first value.
        s2 - the second value.
        Returns:
        false if not equal. true if equal.