Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hii friend, i need your help
I need a c program implementation for fixed length chunking (file divided into fixed size block for ex. 8kb and use the hash value, MD5 or SHA1 to calculate hash for each block)... once a same hash is found, consider the chunk as redundancy: otherwise store the chunk and its hash...
Posted
Updated 12-Feb-15 21:12pm
v3

Set a variable to the total size of the file
REPEAT:
if file size is greater than chunk size
    Read the next chunk
else
    Read the remaining data
Compute the hash for this chunk
Process the chunk and hash ... not sure what you mean here
Subtract last block size from total file size
If total file size greater than zero go back to REPEAT:
 
Share this answer
 
Well, your requirements are clear, after all.
What is you doubt about?
The 'tricky part' is computing the hash value but you may find freely available code for that (e.g. MD5[^]).
 
Share this answer
 
Comments
CPallini 13-Feb-15 3:08am    
You are supposed to provide the solution. We can provide a little help (this is called 'quick answers' after all.
Member 11449136 13-Feb-15 3:07am    
if you have source code so please send me... i need example of source coding..
please help me...

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