Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi All.
I have designed my own hash calculator prototype. I need to come up with file type of different sizes eg. 100KB, 10MB, 100MB, 1GB, etc in order to test the prototype. So, I created the dummy files for these sizes using Dummy File Creator. I tested hashing the real file and hashing the dummy file of the same file size e.g. 1GB. But the results are strikingly different somewhat i.e. the time taken to hash a real 1GB file is so distinct/dissimilar from the time taken to hash a 1GB dummy file. So, just wanna know your thoughts and advice, is it advisable or practical or safe to hash a dummy file? Or, am I facing a bug in my prototype?
Thanks. Appreciate your time.

Regards,
Giggsey
Posted
Comments
Sergey Alexandrovich Kryukov 6-Aug-12 12:15pm    
As you say nothing about your purpose, the question makes no sense at all.
--SA
Giggsey73 6-Aug-12 12:30pm    
So much for my question :)

1 solution

First, there's no reason hashing a dummy file would be unsafe, nor would it be impractical for testing purposes.

As for the difference in time, it's hard to say. If the hashing algorithm changes it's behavior based on the contents of the file (e.g. if the last bit of a block is 0 do A, if it's 1 do B, or something to that effect) and the dummy file only meets the fastest of those conditions, then you'd expect to see it. The real file could also be fragmented, while the dummy file is not. You also have to account for other programs running, the machine it's running on (I assume you tested on the same machine, but maybe you didn't), and any other number of factors. Without more details (for example, what hashing algorithm you're using) it's hard to be sure.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900