Could use some help with Perl to VB

  • Thread starter Thread starter Devon_Nullman
  • Start date Start date
D

Devon_Nullman

Guest
I am trying to get the APPID that Windows uses for its "recent" and "pinned" entries. I have a perl script that works - want to turn it into VB. It involves a CRC64, I have the CRCTable Init done and have checked it against the Perl Table Init but I am having problems with the actual CRC generation

Perl Code:

' Sub crc64()
'{
' My $data = shift;
' My $crc = 0xffffffffffffffff;
'
' While (length($data) > 0)
' {
' My $c = ord(substr($data,0,1));
' $crc = ($crc>>8) ^ $CRCTable[ ($crc ^ $c) & 0xFF ];
' $data=substr($data,1,length($data)-1);
' }
' Return sprintf("%08lX%08lX",$crc>>32, ($crc & "0xFFFFFFFF"));
'}


My VB Code:

Private Function CalculateHash(ByVal table() As UInt64, ByVal buffer As IList(Of Byte)) As UInt64
Dim CHash As ULong = &HFFFFFFFFFFFFFFFFUL 'seed
For Each B As Byte In buffer
CHash = (CHash >> 8) Xor table((CHash Xor B) And &HFFUL)
Next
Return CHash
End Function


On the VB line in the "For loop" I have tried so many different things I cannot even remember what. The results don't match so something must be off.

Continue reading...
 

Similar threads

Back
Top