RT
网上搜索了很多,但是没一个不出问题的。
网上搜索了很多,但是没一个不出问题的。
解决方案 »
- 病毒是怎么把文件发到邮箱里的
- Public dbObj As ADODB.Connection提示ADODB没有定义,怎么回事啊?
- 如何得知当前电脑的分辨率
- 为什么提示找不到ISAM?代码如下。
- 关于自制容器控件的ScaleMode问题,100分
- 有关VB调用Sql Server2000存储过程的参数的选择的问题! 急,在线等
- 如何改变鼠标落形状!!(菜鸟级问)
- 如何屏蔽其他进程的消息框
- VB6.0用Winsock通信出现实时错误87.在线等~~~~
- 讨教日期计算的算法?
- 郁闷最近改进了一下藏拙分词,词库有400万词汇!5000字的文章完全切分居然需要 接近1秒钟的时间!
- 100分诚求高手代码
Private Shared CRC32Table() As Integer
Private Const BUFFER_SIZE As Integer = 1024 Public Shared Function GetCRC32(ByVal file As String) As Integer
Return GetCRC32(file, System.Text.Encoding.Default)
End Function Public Shared Function GetCRC32(ByVal file As String, ByVal encoding As System.Text.Encoding) As Integer
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(file, encoding)
Dim Result As Integer = GetCRC32(sr.BaseStream)
sr.Close()
Return Result
End Function Public Shared Function GetCRC32(ByRef stream As System.IO.Stream) As Integer
Dim crc32Result As Integer
crc32Result = &HFFFFFFFF Dim buffer(BUFFER_SIZE) As Byte
Dim readSize As Integer = BUFFER_SIZE Dim count As Integer = stream.Read(buffer, 0, readSize)
Dim i As Integer
Dim iLookup As Integer
Dim tot As Integer = 0 Do While (count > 0)
For i = 0 To count - 1
iLookup = (crc32Result And &HFF) Xor buffer(i)
crc32Result = ((crc32Result And &HFFFFFF00) \ &H100) And &HFFFFFF
crc32Result = crc32Result Xor CRC32Table(iLookup)
Next i
count = stream.Read(buffer, 0, readSize)
Loop Return Not (crc32Result)
End Function Shared Sub New()
Dim dwPolynomial As Integer = &HEDB88320
Dim i As Integer, j As Integer ReDim CRC32Table(256)
Dim dwCrc As Integer For i = 0 To 255
dwCrc = i
For j = 8 To 1 Step -1
If (dwCrc And 1) Then
dwCrc = ((dwCrc And &HFFFFFFFE) \ 2&) And &H7FFFFFFF
dwCrc = dwCrc Xor dwPolynomial
Else
dwCrc = ((dwCrc And &HFFFFFFFE) \ 2&) And &H7FFFFFFF
End If
Next j
CRC32Table(i) = dwCrc
Next i
End Sub
End Class