找回密码
 立即注册
相关推荐换一批
  1. SJ/T 207.2-1999 设计文件管理制度 第2部分:设计文件的格式
  2. SJ/T 207.1-1999 设计文件管理制度 第1部分:设计文件的分类和组成
  3. GB/T 15387.1-1994 术语数据库开发文件编制指南
  4. NY/T 762-2004 蔬菜农业残留检测抽样规范
  5. GB/T 3382-1993 文件传真三类机在电话网中的互通技术条件
  6. SJ 2785-1987 雷达产品随机文件
  7. SJ/T 10151-1991 电子产品设计文件的标准化检查
  8. SJ/T 11156-1998 计算机辅助设计 设计文件档案管理制度
  9. SJ/T 10719-1996 电子设备设计文件编制示例
  10. SJ/T 10631-1995 工艺文件的编号
  11. SJ/T 10375-1993 工艺文件格式的填写
  12. SJ/T 10323-1992 电池产品设计文件的分类编号
  13. GB/T 19097-2003 技术产品文件 生命周期模型及文档分配
  14. GB/T 18253-2000 钢及钢产品 检验文件的类型
  15. FZ/T 90066-1995 纺织机械 产品图样及设计文件的更改
  16. FZ/T 90012-1991 材料在图样及设计文件中的标记方法
  17. FZ/T 91003.8-1993 纺织机械制造工艺管理导则 工艺文件的修改
  18. FZ/T 91003.7-1993 纺织机械制造工艺管理导则 工艺文件标准审查
  19. FZ/T 91001.4-1993 纺织机械制造工艺文件 工艺装备设计图样及文件格式
  20. FZ/T 91001.1-1993 纺织机械制造工艺文件 工艺文件完整性及审批程序
  21. GB/T 13959-1992 文件格式分类与代码编制方法
  22. SJ/T 207.8-2001 设计文件管理制度 第8部分:图样编制
  23. SJ/T 207.7-2001 设计文件管理制度 第7部分:电气简图的编制
  24. SJ/T 207.6-2001 设计文件管理制度 第6部分:项目代号
哈希文件theFile | C#编程 2021-06-11 502 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