找回密码
 立即注册
相关推荐换一批
  1. QJ 903.9A-1995 航天产品工艺文件管理制度 管理用工艺文件编制规则
  2. QJ 903.1A-1995 航天产品工艺文件管理制度 总则
  3. QJ 1091A-1998 设计文件使用与归档管理规定
  4. QJ 13A-1997 设计文件的分类编号
  5. QJ 1714.6A-1999 航天产品设计文件管理制度 设计文件的完整性
  6. QJ 1714.5A-1999 航天产品设计文件管理制度 设计文件的编号
  7. QJ 1714.8-1989 航天产品设计文件管理制度 文字内容设计文件的编制
  8. DA/T 22-2000 归档文件整理规则
  9. GB/T 10198.2-1988 传真机技术要求 二类文件传真机
  10. JB/T 5054.8-1991 产品图样及设计文件 通用件及借用件管理办法
  11. GB/T 12852-1991 磁控管总规范 (可供认证用)
  12. SJ/T 211.5-1997 电子工业专用设备设计文件 第5部分:编号方法
  13. YY/T 0047-1991 医疗器械产品图样及设计文件的术语
  14. YD/T 703-1993 文件传真三类机检验测试方法
  15. YD/T 172-1994 邮电工业工艺文件格式
  16. TB/T 122-2001 机车车辆产品图样及设计文件编号原则
  17. QJ 903.9-1985 通用工艺文件编制规则
  18. CJ/T 166-2006 建设事业集成电路(IC)卡应用技术
  19. SJ/T 207.5-1999 设计文件管理制度 第5部分:设计文件的更改
  20. SJ/T 207.2-1999 设计文件管理制度 第2部分:设计文件的格式
  21. SJ/T 207.1-1999 设计文件管理制度 第1部分:设计文件的分类和组成
  22. GB/T 15387.1-1994 术语数据库开发文件编制指南
  23. NY/T 762-2004 蔬菜农业残留检测抽样规范
  24. GB/T 3382-1993 文件传真三类机在电话网中的互通技术条件
哈希文件theFile | C#编程 2021-06-11 495 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
C# Self Hashing Application,C# 自散列应用程序计算哈希码
使用 MD5 和 SHA1 等算法计算文件的哈希码并不太困难。
但是一个计算自己哈希码的应用程序呢? 棘手的部分是在使用中读取应用程序文件。
打开文件
要计算正在运行的应用程序的哈希值,程序需要读取自己的执行文件。 但是,由于文件正在使用中,因此某些读取文件的方法会出现如下错误:
该进程无法访问文件“[文件路径]”,因为它正被另一个进程使用。
我们可以通过使用正确的 .NET 类来读取打开的文件来避免这种类型的错误。 例如,System.IO.File 类有一个静态函数 OpenRead,它返回一个流来读取文件的内容。
使用 OpenRead,C# 开发人员可以提取任何文件的字节数据,包括正在运行的应用程序之一。


(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.)

1623387244431.rar


上一篇:C# XOR Encryption
下一篇:MethodLogger - Hook into method calls in .NET binaries