Question: Write a function (in python) that creates a 32-bit hash of a file (you can represent 32-bits in hexadecimal and use it as the output

Write a function (in python) that creates a 32-bit hash of a file (you can represent 32-bits in hexadecimal and use it as the output for simplicity) through the following steps:

1. Initialize the hash to all zeros.

2. Scan the file one byte at a time.

3. Before a new byte is read from the file, circularly shift the bit pattern in the hash to the left by 8 positions.

-Note that if there is no more data to read, you stop here (i.e., after shifting).

4. XOR the new byte read from the file with the least significant byte (the rightmost) of the hash.

5. Scan your directory (a very simple thing to do in Python), and compute the hash of all your files.

6. Dump the hash values in some output file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!