MD5 and SHA-1 Hash value generation

247 views Asked by At

How to generate MD5 hash value for a file? I mean the working of it how is the value generated or you can say which logic is used so that i get the hash value

Explain me in very simple words or diagram Also tell me in Simple words.How is the Hash value of SHA-1 generated for a file? I mean the working of it how is the value generated or you can say which logic is used so that i get the hash value

Please help.

2

There are 2 answers

1
onlytiancai On

in python

import md5
md5.md5(open('temo.txt').read()).hexdigest()
0
Bodo On

Here is the definition of the SHA1, I found it's easy to see how data is processed into a SHA-1 hash:

http://www.itl.nist.gov/fipspubs/fip180-1.htm

I recently used to get a SHA-1, so I found a free to use implementation (and the above link) here:

http://www.packetizer.com/security/sha1/

More or less, the SHA-1 one cuts equal sized chunks of your data, "mixes" them and "adds" them to the prior value until no data is left. This is how I understood the algorithm. Of course "mixes" and "adds" are not very exact, but the details are explained in the link above.

I did not use the md5, I'm sure someone else can help you about this.