public static boolean equals(ByteString bs, ByteString other, boolean checkHash)
    {
        final int size = bs.bytes.length;
        if (size != other.bytes.length)
        {
            return false;
        }

        if (checkHash)
        {
            // volatile reads
            final int h1 = bs.hash, h2 = other.hash;
            if (h1 != 0 && h2 != 0 && h1 != h2)
            {
                return false;
            }
        }

        final byte[] thisBytes = bs.bytes;
        final byte[] otherBytes = other.bytes;
        for (int i = 0; i < size; i++)
        {
            if (thisBytes[i] != otherBytes[i])
            {
                return false;
            }
        }

        return true;
    }
Returns true if the contents of both match.
protostuff-api/src/main/java/io/protostuff/ByteString.java