|
ありがとうございます。
Uintegerにする方法ですが これで良いでしょうか?
Public Function GetCRC32_2(ByVal sFileName As String) As String
Try Dim FS As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 8192) Dim CRC32Result As Integer = &HFFFFFFFF Dim Buffer(4096) As Byte Dim ReadSize As Integer = 4096 Dim Count As Integer = FS.Read(Buffer, 0, ReadSize) Dim CRC32Table(256) As Integer Dim DWPolynomial As Integer = &HEDB88320 Dim DWCRC As Integer Dim i As Integer, j As Integer, n As Integer
'Create CRC32 Table 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
'Calcualting CRC32 Hash Do While (Count > 0) For i = 0 To Count - 1 n = (CRC32Result And &HFF) Xor Buffer(i) CRC32Result = (CRC32Result >> 8) Xor CRC32Table(CInt(n)) Next i Count = FS.Read(Buffer, 0, ReadSize) Loop Return Hex(Not (CRC32Result)) Catch ex As Exception Return "" End Try
End Function
CRC32Result だけuintegerにしましたが、 計算結果が出力されません。 CRCTableもuintegerにしてみましたが、 CRCTableが出力されずに終了してしまいます。
どうすれば良いでしょうか?
|