Note that there are some explanatory texts on larger screens.

plurals
  1. POSHA256 hash calculation
    primarykey
    data
    text
    <p>for my employer I have to present customers of a web-app with checksums for certain files they download.</p> <p>I'd like to present the user with the hash their client tools are also likely to generate, hence I have been comparing online hashing tools. My question is regarding their form of hashing, since they differ, strangely enough.</p> <p>After a quick search I tested with 5:</p> <ol> <li><a href="http://www.convertstring.com/Hash/SHA256" rel="nofollow">http://www.convertstring.com/Hash/SHA256</a></li> <li><a href="http://www.freeformatter.com/sha256-generator.html#ad-output" rel="nofollow">http://www.freeformatter.com/sha256-generator.html#ad-output</a></li> <li><a href="http://online-encoder.com/sha256-encoder-decoder.html" rel="nofollow">http://online-encoder.com/sha256-encoder-decoder.html</a></li> <li><a href="http://www.xorbin.com/tools/sha256-hash-calculator" rel="nofollow">http://www.xorbin.com/tools/sha256-hash-calculator</a></li> <li><a href="http://www.everpassword.com/sha-256-generator" rel="nofollow">http://www.everpassword.com/sha-256-generator</a></li> </ol> <p>Entering the value 'test' (without 'enter' after it) all 5 give me the same SHA256 result. However, and here begins the peculiar thing, when I enter the value 'test[enter]test' (so two lines) online tool 1, 2 and 3 give me the same SHA256 hash, and site 4 and 5 give me a different one (so 1, 2 and 3 are equal, and 4 and 5 are equal). This most likely has to do with the way the tool, or underlying code handles \r\n, or at least I think so.</p> <p>Coincidentally, site 1, 2 and 3 present me with the same hash as my C# code does:</p> <pre><code> var sha256Now = ComputeHash(Encoding.UTF8.GetBytes("test\r\ntest"), new SHA256CryptoServiceProvider()); private static string ComputeHash(byte[] inputBytes, HashAlgorithm algorithm) { var hashedBytes = algorithm.ComputeHash(inputBytes); return BitConverter.ToString(hashedBytes); } </code></pre> <p>The question is: which sites are 'right'? </p> <p>Is there any way to know if a hash is compliant with the standard?</p> <p>UPDATE1: Changed the encoding to UTF8. This has no influence on the output hash being created though. Thx @Hans. (because my Encoding.Default is probably Encoding.UTF8)</p> <p>UPDATE2: Maybe I should expand the question a bit, since it may have been under-explained, sorry. I guess what I am asking is more of a usability question than a technical one; Should I offer all the hashes with different line endings? Or should I stick to one? The client will probably call my company afraid that their file was changed somehow if they have a different way of calculating the hash. How is this usually solved?</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. 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