PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<count_charscrypt>
Last updated: Mon, 16 Jul 2012

crc32

(PHP 4 >= 4.0.1, PHP 5)

crc32 -- 计算一个字符串的 crc32 多项式

描述

int crc32 ( string str )

生成 str 的 32 位循环冗余校验码多项式。这通常用于检查传输的数据是否完整。

由于 PHP 的整数是带符号的,许多 crc32 校验码将返回负整数,因此你需要使用 sprintf()printf() 的“%u”格式符来获取表示无符号 crc32 校验码的字符串。

示例中的第二行演示了如何使用 printf() 函数转换校验码:

例子 1. 显示 crc32 校验码

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

参见 md5()sha1()




<count_charscrypt>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST