-4

I am deploying a file along with a C# application. And I want to make sure that file is same as it was supplied otherwise the C# application will show error. Now, a file's creation and modification date can be changed after it is modified. Is there any checksum/hash etc. in C# to make sure file is not changed by user.

Computer User
  • 2,839
  • 4
  • 47
  • 69

1 Answers1

6

Yes, you could for instance use SHA1 to get a hash that you hard-code into the app and check the file against. But if you don't want the file to ever change, it would probably make more sense to simply build the file into the .exe as an embedded resource and read it directly from the .exe rather than from the filesystem.

adv12
  • 8,443
  • 2
  • 24
  • 48