Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

md5suming a file is fine, but I cannot seem to invoke md5sum to calculate the hash based only on the file's contents. (For those wondering, I'd prefer that multiple wgets of the same file return the same md5 hash. md5summing the file keeps reporting different hashes because the timestamp on the file is different.)

julian@julian-computer:/tmp$ md5sum < `cat index.html`
bash: `cat index.html`: ambiguous redirect
share|improve this question
6  
md5sum index.html, md5sum < index.html, cat index.html | md5sum, md5sum < <(cat index.htm) and md5sum <<< "$(< index.html)" all calculates MD5 hash of the file's content. If you get different MD5 hashes for the same file downloaded multiple times, then there are differences in their content. Show some exact URLs so we can prove it to you. (Note that the .html extension does not mean the file is static. PHP or other interpreters can also parse files with .html extension, or the web server may rewrite the requested URL internally.) –  manatwork Oct 6 '11 at 16:59
    
Hi manatwork. Confirmed, I was just using md5sum incorrectly. Thanks. –  Julian H. Lam Oct 6 '11 at 17:18
add comment

1 Answer

up vote 2 down vote accepted

Md5sum and other hashing functions have nothing to do with the timestamp of the file for which the checksum is being calculated. Unless you have some weird version installed it processes only the contents of the file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.