Hi,

I have a text file, which i need to make sure is not getting modified.
I have to mail this file to people and the file should not be modified by anyone in transit.

What would be the best way to accomplish this.

Posting it here because I was thinking of creating a checksum verifying tool or sorts...

A checksum seems a good idea, MD5 SHA, that kind of thing.
Have a look at the MessageDigest class It's simple to use, but you'll find example code on the web as well.

But if i am using a hash function, how do i transmit the hashcode?
Is there a way to attach it with the file.

The scenario i am looking at is like this:
A sends the file to B. B has to verify the file integrity. Now B send it to C. C should also verify the integrity of the file, ie. it is the same file A send and B did not modify.

If you send it with the file than C won't know if B has changed the file and updated the hash to match. C will have to check with A somehow to get the original hash.
Alternatively you could go to a full private/public key solution where A hashes/signs the file with his private key and anyone can use his public key to conform the file's integrity.

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.