问题描述
全部,
任何人都可以在VB.NET中为计算String的CRC提出建议.
谢谢您.
Hai All,
Can Anybody give a sugession for calculating CRC for String in VB.NET.
Thank You
推荐答案
string input = //...
//...
byte[] data = System.Text.Encoding.UTF8.GetBytes(input);
请参阅:
http://msdn.microsoft.com/en-us/library/system.text. encoding.aspx [^ ].
请注意,.NET内部在内存中使用的编码为UTF-16LE.在这种意义上,所有UTF编码都是等效的,即使它们包含的字符编码点需要16个或更多(最多32个)位才能容纳,它们也可以对任何Unicode测试进行编码而不会造成任何损失.面向字节的UTF-8使用可变大小的字节序列表示一个字符,而UTF-16使用一个16位字或两个这样的字(称为代理对" )表示单个字符.这样,可以表示Unicode范围0到0x10FFFF的任何字符.
请参阅:
http://en.wikipedia.org/wiki/Unicode [ ^ ],
http://en.wikipedia.org/wiki/Code_point [ ^ ],
http://unicode.org/ [ ^ ],
http://unicode.org/faq/utf_bom.html [ ^ ].
Please see:
http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[^].
Note that the encoding used by .NET internally in memory is UTF-16LE. All UTF encodings are equivalent in that sense that they encode any Unicode test without any losses, even if the text contains characters with the code point requiring 16 or more (up to 32) bits to fit. Byte-oriented UTF-8 uses variable-size byte sequences to represent one character, and UTF-16 uses one 16-bit words or two such words (called surrogate pair) to represent a single character. In this way, any character in the Unicode range 0 to 0x10FFFF can be represented.
Please see:
http://en.wikipedia.org/wiki/Unicode[^],
http://en.wikipedia.org/wiki/Code_point[^],
http://unicode.org/[^],
http://unicode.org/faq/utf_bom.html[^].
这篇关于如何在VB.NET中计算CRC16校验和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!