Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Set parameters of qChecksum



  • Hi Folks,

    I need to generate checksum for an array of data. Its stored in QByteArray, and as I googled, I found the qChecksum method, but I couldnot figure out, how should I set the parameters for CRC, like:

    • applied algorithm
    • seed
    • polinome
    • etc...

    can anybody explain me, how I can use this method, or is there any alternative Qt solution for CRC generation?

    Regards,
    Norbert



  • There are no more Parameters to set in qChecksum see Documentation:

    quint16 qChecksum(const char * data, uint len)

    Returns the CRC-16 checksum of the first len bytes of data.

    The checksum is independent of the byte order (endianness).

    **Note: This function is a 16-bit cache conserving (16 entry table) implementation of the CRC-16-CCITT algorithm.
    **

    But maybe you can use QCryptographicHash Class

    Currently MD4, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 are supported.



  • Hi,

    I read the description of the method, but you can check for example this bug report:
    https://bugreports.qt.io/browse/QTBUG-8595

    In order to generate CRC, you need (you can set) to adjust more parameter as the input data.

    Regards,
    Norbert


Log in to reply