FastCRC Library Type Library

FCRC32_Final

long FCRC32_Final( [in, out]long* pCRC );

Return value

The checksum.
 

Parameters

pCRC

    [in/out] The crc variable.

Remarks

Call this function to retrieve the checksum from the crc variable specified by pCRC.

After the FCRC32_Final function is performed, the crc variable is initialized for new calculations, as it would be called FCRC32_Init again.

Note. Before the first call to FCRC32_Update, FCRC32_UpdateStr or FCRC32_Final functions, the crc variable must be initialized with FCRC32_Init.

VB Example

Private Sub MyButton_Click()   
   Dim strdata As String
   strdata = "Hello World!"

   Dim strlength As Long
   strlength = Len(strdata)

   'Convert the string to byte array
   Dim bindata() As Byte
   ReDim bindata(1 To strlength)
   For i = 1 To strlength
      bindata(i) = Asc(Mid(strdata, i, 1))
   Next i

   'Initialize the crc variable to store intermediate results between function calls
   Dim crcvar As Long
   FCRC32_Init crcvar

   'Update the crc variable with first part
   Dim firstpart As Long
   firstpart = strlength / 3
   FCRC32_Update crcvar, bindata(1), firstpart

   'Update the crc variable with second part
   FCRC32_Update crcvar, bindata(firstpart + 1), strlength - firstpart

   'Get the checksum
   Dim checksum As Long
   checksum = FCRC32_Final(crcvar)

   'Show the hexadecimal representation of the checksum
   MsgBox FCRC_LongToHex32(checksum, True)
End Sub

 

Type Library Overview   |   Type Library Functions   |   Useful Links   |   HashCalc

 

See Also    FCRC32_Update, FCRC32_UpdateStr, FCRC32_Init, FCRC_LongToHex32 


 

 

Send Feedback to SlavaSoft Inc. Tell a friend about FastCRC Library