CRC32 functions for PHP and Python

Source: Internet
Author: User
Tags crc32 function prototype

When a Web server communicates with an app server, it often uses different languages on both ends. For example, this time I met PHP and C.

PHP as a high-level language, a variety of convenient library functions are readily accessible, in the PHP crc32 function call process, only need a parameter: The data is verified to be OK.

However, in C language is not the same, the CRC32 function prototype is unsigned int crc32 (unsigned int crc,unsigned char *buf,int size) Three parameters are generated polynomial, verified data, the data length is verified. The return value is a CRC check code

So the question is, when the Web side uses PHP's CRC32 function checksum, what parameters does the app server use to verify the data transmitted by the Web?

I found a lot of information, there is said to be CRC32 standard generation polynomial 0x4c11db7, there is said to be 0xFFFFFFFF, try to be wrong.

Finally read a piece of information, said PHP after the CRC to take the reverse once, with 0xFFFFFFFF to try again, OK, right!

CRC32 functions for PHP and Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.