Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Looking for some code which can hash an entire physical hard disk for a project

Need to Hash Disk Drive/Solid State Drives while Cloning & Imaging

What I have tried:

Have tried searching over how to implement hashing for physical drive but didn't find anything concrete.
Posted
Updated 1-Apr-19 1:51am
v2
Comments
Nirav Prabtani 1-Apr-19 7:01am    
Why do you need to do hashing of entire hard disk ??
Member 14207297 1-Apr-19 7:06am    
To determine that the disk data copied from the source disk0 to destination disk1 100% replicated including free areas
#realJSOP 1-Apr-19 7:18am    
How do you expect to hash free space on a drive?
Member 14207297 1-Apr-19 7:41am    
We need to consider Physical Drive instead of Logical drive. In this case we read the entire drive in raw format. This can be viewed through hex viewer sector by sector. So now hash values need to be generated by considering a drive data bit-by-bit or else sector by sector. This will help to generate hash of entire physical drive.
Richard MacCutchan 1-Apr-19 7:40am    
You need to access the raw sectors to read the entire drive. Google for samples and explanations.

1 solution

Hashing works on a byte stream, or similar - it doesn't care where you get it's data from. So as long as you can read your free space you can include it in the hash value. I wouldn't though, for the same reasons that most backup systems don't - it's technically irrelevant data which takes up valuable backup space, was well as being a potential security risk.

Whatever bytes you provide to the hashing algorithm will be used to generate the hash code, so you can use any hashing algorithm you feel appropriate. I'd suggest MD5 for this, despite it being "broken" since there is no attempt to reverse the code and this isn't a security application - it's a lot faster than SHA-512 or similar and will provide a similar level of "confirmation".

A quick google will find you loads of info on MD5 and SHA hashes.
 
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