Android Question Help with CRC32 function

Discussion in 'Android Questions' started by Hirogens, Jun 14, 2018.

  1. Hirogens

    Hirogens Active Member Licensed User

    Hello, I try to recode a CRC32 calcul function, but I don't know how to do it on B4A.
    This is the code I would translate for B4A
    uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc)
       uint32_t crc;

       crc = (p_crc == 
    NULL) ? 0xFFFFFFFF : ~(*p_crc);
    for (uint32_t i = 0; i < size; i++)
           crc = crc ^ p_data[i];
    for (uint32_t j = 8; j > 0; j--)
               crc = (crc >> 
    1) ^ (0xEDB88320U & ((crc & 1) ? 0xFFFFFFFF : 0));
       return ~crc;
    My first parameter is an array of byte which contain my data, and the second in the size of my data.
    Thanks =)
  2. Hirogens

    Hirogens Active Member Licensed User

    It's okay I find a solution !
  3. Erel

    Erel Administrator Staff Member Licensed User

    Always better to post the solution...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice