Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>GetHashCode</code> is not defined for array types - you have to implement your own hash algorithm.</p> <p>The value you see is actually based on the underlying reference and so two identical arrays will always have different hash codes, unless they are the same reference.</p> <p>For integral types 32-bits or less, the hash code is equal to the value as converted to a 32-bit integer. For the 64 bit integral type, <code>Int64</code>, the upper 32 bits are XORed with the lower 32 bits (there's a shift in there also) for the hash code.</p> <p>So when it comes to trying to compare two arrays 'quickly', you have to do it yourself.</p> <p>You can use logic checks first - lengths are equal, start and end with the same byte value etc. Then you have a choice - either read byte - by - byte and compare values (or you can read 4 or 8 bytes at a time and use the <code>BitConverter</code> to convert blocks of bytes to <code>Int32</code> or <code>Int64</code> to make a single pair of values that <em>might</em> be quicker to check for equality) or use a general-purpose hash function to get a good guess of equality.</p> <p>For this purpose you can use an MD5 hash - it's very quick to output a hash with MD5: <a href="https://stackoverflow.com/questions/16340/how-do-i-generate-a-hashcode-from-a-byte-array-in-c-sharp">How do I generate a hashcode from a byte array in C#?</a>.</p> <p>Getting two identical hash values from such a hash function does not <em>guarantee</em> equality, but in general if you are comparing arrays of bytes within the same data 'space' you shouldn't get a collision. By that I mean that, in general, examples of different data of the same type should nearly always produce different hashes. There's a lot more around the net on this than I am qualified to explain.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload