我该如何计算code运行时校验? [英] How can I calculate the checksum of code at runtime?

查看:112
本文介绍了我该如何计算code运行时校验?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有运行的计算机上的C#.NET应用程序。如何计算的整个code校验在运行时?

I have a C#.NET application running on a machine. How do I calculate the checksum of the entire code at runtime?

我不想计算图像中使用,但实际的code部分的校验和。

I do not want to calculate the checksum of the image in use but the actual code part.

推荐答案

我从来没有使用过这一点,但是:

I have never used this, but:

使用反射,你可以浏览到 GetILAsByteArray ,做一个校验和(每个方法)。

Using reflection you can navigate to the GetILAsByteArray and do a checksum (per method).

不过,我认为这将是一个更容易使用code签字或Assembly.GetExecutingAssembly,然后做该.dll或.exe的校验和。

But I think it will be a lot easier to use code signing or the Assembly.GetExecutingAssembly and then do a checksum on the .dll or .exe.

这篇关于我该如何计算code运行时校验?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆