Sample code for 30+ languages & platforms
PureBasic

Example: Crypt2.CrcBd method

Demonstrates how to call the CrcBd method.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkCrypt2.pb"
IncludeFile "CkBinData.pb"

Procedure ChilkatExample()

    crypt.i = CkCrypt2::ckCreate()
    If crypt.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    bd.i = CkBinData::ckCreate()
    If bd.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkBinData::ckAppendString(bd,"123456789","us-ascii")

    crc32.i = CkCrypt2::ckCrcBd(crypt,"crc-32",bd)
    ; The decimal value is 3421780262 (converted to hex is 0xCBF43926)
    Debug Str(crc32)

    crc8.i = CkCrypt2::ckCrcBd(crypt,"crc8",bd)
    Debug Str(crc8)


    CkCrypt2::ckDispose(crypt)
    CkBinData::ckDispose(bd)


    ProcedureReturn
EndProcedure