首页
社区
课程
招聘
[求助]C# Self Hashing Application
发表于: 2010-8-26 04:57 1254

[求助]C# Self Hashing Application

2010-8-26 04:57
1254
C# Self Hashing Application
Calculating Hash Code

Calculating the hash code of a file using algorithms such as MD5 and SHA1 is not too difficult.

But what about an application that computes its own hash code? The tricky part is reading the application file while it is in use.
Open File

To calculate the hash value of the running application the program needs to read its own executing file. However since the file is in use, some methods to read the file will give an error like this:

The process cannot access the file '[file path]' because it is being used by another process.

We can avoid this type of error by using the proper .NET classes to read an open file. For example, the System.IO.File class has a static function OpenRead which returns a stream to read the content of the files.

With OpenRead a C# developer can extract the byte data of any file, including the one of the running application.

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

上传的附件:
收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//