def _hash_comparator()

in pyqldb/util/qldb_hash.py [0:0]


    def _hash_comparator(h1, h2):
        """
        Compares two hashes by their **signed** byte values in little-endian order.
        """
        h1_array = array('b', h1)
        h2_array = array('b', h2)

        if len(h1) != 32 or len(h2) != 32:
            raise ValueError("Invalid hash")
        for i in range(len(h1_array) - 1, -1, -1):
            difference = h1_array[i] - h2_array[i]
            if difference != 0:
                return difference
        return 0