VB Script – CRC32 cheksum function 追蹤

Murielle JARDIN


I want to create a CRC32 checksum algorithm which applied to a data generate a lock used to detect data corruption. In macro function of an Excel Table, the CRC32 VB Script gives good result but in Bartender some actions are not recognized : “as long”, “as string”, “StrConv”.


My questions are :

  • with what “words or functions” can I replace “as long”, “as string”, “StrConv” ? Can you show me some examples, please ?
  • Know you a CRC32 VB Script which gives good results in Bartender ?


Below an extract of CRC32 VB Script used in Bartender (“as long”, “as string” have been removed”) :


Function MaFonction(CRC32)

Dim crc32Table(256)

    crc32Table(0) = 0

    crc32Table(1) = 1996959894

    crc32Table(2) = -301047508

    crc32Table(3) = -1727442502

    crc32Table(4) = 124634137

    crc32Table(5) = 1886057615… 

   Dim crc32Result

   crc32Result = &HFFFFFFFF

   Dim i

   Dim iLookup

   Dim buffer()

   buffer = StrConv(CRC32, 128)


   For i = LBound(buffer) To UBound(buffer)

      iLookup = (crc32Result And &HFF) Xor buffer(i)

      crc32Result = ((crc32Result And &HFFFFFF00) \ &H100) And 16777215

      ' nasty shr 8 with vb :/

     crc32Result = crc32Result Xor crc32Table(iLookup)


    checkCRC32 = Not (crc32Result)

  End Function 


Thanks a lot for your answers

Best regards