欧美AV无码一区二区,麻豆+无码+国产在线+观看,欧美狂躁少妇XXXX高潮无码,美女扒开屁股让男人桶免费观看,极品粉嫩国产18尤物在线播放

crc32

(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)

crc32計算一個(gè)字符串的 crc32 多項式

說(shuō)明

crc32(string $str): int

生成 str 的 32 位循環(huán)冗余校驗碼多項式。這通常用于檢查傳輸的數據是否完整。

警告

由于 PHP 的整數是帶符號的,所以在 32 位系統上許多 crc32 校驗碼將返回負整數。 盡管在 64 位上所有 crc32() 的結果將都是正整數。

因此你需要使用 sprintf()printf() 的“%u”格式符來(lái)獲取表示無(wú)符號 crc32 校驗碼的字符串。

For a hexadecimal representation of the checksum you can either use the "%x" formatter of sprintf() or printf() or the dechex() conversion functions, both of these also take care of converting the crc32() result to an unsigned integer.

Having 64bit installations also return negative integers for higher result values was considered but would break the hexadecimal conversion as negatives would get an extra 0xFFFFFFFF######## offset then. As hexadecimal representation seems to be the most common use case we decided to not break this even if it breaks direct decimal comparisons in about 50% of the cases when moving from 32 to 64bits.

In retrospect having the function return an integer maybe wasn't the best idea and returning a hex string representation right away (as e.g. md5() does) might have been a better plan to begin with.

For a more portable solution you may also consider the generic hash(). hash("crc32b", $str) will return the same string as dechex(crc32($str)).

參數

str

要校驗的數據。

返回值

返回 str crc32 校驗的整數。

范例

示例 #1 顯示一個(gè) crc32 校驗碼

示例中的第二行演示了如何使用 printf() 函數轉換校驗碼:

<?php
$checksum 
crc32("The quick brown fox jumped over the lazy dog.");
printf("%u\n"$checksum);
?>

參見(jiàn)

  • hash() - 生成哈希值 (消息摘要)
  • md5() - 計算字符串的 MD5 散列值
  • sha1() - 計算字符串的 sha1 散列值

欧美AV无码一区二区,麻豆+无码+国产在线+观看,欧美狂躁少妇XXXX高潮无码,美女扒开屁股让男人桶免费观看,极品粉嫩国产18尤物在线播放