0

我正在寻找可以在 .Net Micro 框架上使用的 CRC32 实现。我找到了这个实现,但是微框架还没有实现HashAlgorithm。让这个工作的最好方法是什么?

4

3 回答 3

2

.net 微框架有 Utility.ComputeCRC 方法,尽管我不确定实际使用的是什么算法。它当然不使用 OP 中的一个。 Utility.ComputeCRC

于 2011-12-13T11:08:10.877 回答
1

You can use the code you are referring to. HashAlgorithm is just used as an Interface and you can drop it without harming the functionality of the CRC implementation itself.

Change "protected override void HashCore(byte[] buffer, int start, int length)" to "public void CalcCrc32(byte[] buffer, int start, int length)".

public uint CrcValue should return crcValue unaltered.

Drop all other methods and properties.

于 2011-10-18T10:01:29.757 回答
1

尝试从http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.47.04.55/CRC_5F00_Lib.zip实施 CRC 。这是在http://vbcity.com/forums/t/111345.aspx讨论的实现。

您可以在http://www.lammertbies.nl/comm/info/crc-calculation.html验证您的 CRC 计算的正确性。

上述来自 vbcity 讨论的链接实际上实现了http://www.lammertbies.nl/comm/info/crc-calculation.html给出的 c++ 库的转换。

我发现这适用于我的 CRC 16 实施。

一个简短的代码片段是

        ushort crcno = CRC.CRC16(stryourdata);
        Byte[] crcbytes = BitConverter.GetBytes(crcno);
于 2011-10-18T09:41:25.733 回答