Hi,
Iam using filestreams to create binary file (c:\..\abc.bin).I want to put some checksum when i try to open the file through programming ,like if it is previously modified through another application or done manually.At the point of opening the binary file i need to perform some checksum by checking it's size.but how we know the size of the file before corrupted. (or) can any one tell me how we perform checksum like wether the given file is corrupted or not..just give me the logic..
thanks in advance.....
thammalatha
0
Newbie Poster
Recommended Answers
Jump to PostGenerate a hash (checksum) value using such algorithms as MD5, SHA1 etc. on the original file.
To later verify whether or not the file has been altered, you must run the file thru the algorithm again. You will get a different hash value if one single byte of the file …
Jump to PostYou put it as a function inside that Entry class.
class Entry{ //clas stuff; FileSize(std::string Path) { std::ifstream Stream(Path.c_str()); if (Stream.is_open()) { int Start = Stream.tellg(); Stream.seekg(0, std::ios::end); int End = Stream.tellg(); Stream.close(); return (End - Begin); } return -1; } };
and inside the while …
All 8 Replies
triumphost
120
Posting Whiz
jalpesh_007
commented:
just provide idea...you are not teaching here by giving code...it's not good..
+0
thammalatha
0
Newbie Poster
BobS0327
24
Junior Poster in Training
thammalatha
0
Newbie Poster
thammalatha
0
Newbie Poster
Lucaci Andrew
140
Za s|n
BobS0327
24
Junior Poster in Training
thammalatha
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.