更新时间:2023-02-06 15:43:24
选择校验和算法并实现它.您有足够的算法可供选择,请参见 http://en.wikipedia.org/wiki/Checksum [ ^ ].请参阅本文引用的Web.
您可以使用已经实现的 Cryptographic Hash Function ( http://en.wikipedia.org/wiki/Cryptographic_hash_function [ ^ ]),位于名称空间System.Security.Cryptography
中,例如,使用从System.Security.Cryptography.HashAlgorithm
派生的分类之一,每个分类代表"SHA"家族的加密哈希函数(请参见 http ://en.wikipedia.org/wiki/SHA-2 [ ^ ])或MD5( http://en.wikipedia.org/wiki/MD5 [ ^ ]),使用类System.Security.Cryptography.MD5
.
注意:请勿出于任何安全目的使用MD5,因为该算法被认为已损坏,请参见 http: //en.wikipedia.org/wiki/MD5 [ ^ ].对于校验和而言,这已经足够了.
在这里,我找到了CRC实现:
CRC编码 [
Choose a checksum algorithm and implement it. You have enough algorithms to choose from, see http://en.wikipedia.org/wiki/Checksum[^]. See the Web referenced from this article.
You can use already implemented Cryptographic Hash Function (http://en.wikipedia.org/wiki/Cryptographic_hash_function[^]) from the name spaceSystem.Security.Cryptography
, for example, use one of the classed derived fromSystem.Security.Cryptography.HashAlgorithm
each representing a Cryptographic Hash Function from the "SHA" family (see http://en.wikipedia.org/wiki/SHA-2[^]) or MD5 (http://en.wikipedia.org/wiki/MD5[^]) using the classSystem.Security.Cryptography.MD5
.
Note: Don''t use MD5 for any security purposes, as this algorithm is considered broken, see http://en.wikipedia.org/wiki/MD5[^]. For checksum purposes it is good enough though.
Here I found CRC implementation:
CRC Encoding[^].
There are many others.—SA