none
hash values in .net, how do you predict the length of the returned hash value in bytes? RRS feed

  • Question

  • there werent many choices where I could post this question...  We may prefer to use a hash function in .net (ie at a business layer) over something like the checksum function in sql server (at the db layer), but store the resulting hash value in the database.   The hash value would help to ensure the integrity of rows in our database saving us the hassles of encryption etc.

     

    I see lots of stuff out there on MD2, MD5, SHA, salt values etc but cannot get a feel for how many bytes a base 64 string hash value would occupy in our database.  I assume it has something to do with the length of the parameter passed to the hashing algorithm but would like to know 1) if there are any rules of thumb on predicting the length  or 2) perhaps some known algorithms that always return a fixed length hash value no matter what was passed.   

    Monday, February 18, 2008 4:27 PM

Answers

  • Hash algorithms are designed to return a fixed length output, regardless of the input length. The SHA algorithm has 3 flavors that vary in output length from 160 bits (20 bytes) to 512 bits (64 bytes). The key length has a lot to do with the chance that two different inputs will produce the same output without being identical.

     

    Monday, February 18, 2008 5:36 PM