Contents 

SlavaSoft FastCRC Library Online Help

Prev Page Next Page
FastCRC Library Type Library

FCRC16_Final

long FCRC16_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 FCRC16_Final function is performed, the crc variable is initialized for new calculations, as it would be called FCRC16_Init again.

Note. Before the first call to FCRC16_Update, FCRC16_UpdateStr or FCRC16_Final functions, the crc variable must be initialized with FCRC16_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
   FCRC16_Init crcvar

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

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

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

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

 

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

 

See Also    FCRC16_Update, FCRC16_UpdateStr, FCRC16_Init, FCRC_LongToHex16 


 

 

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