2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-06-20 22:25:43 +00:00
|
|
|
<!-- $Revision: 1.9 $ -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.crc32">
|
2007-06-11 00:50:00 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>crc32</refname>
|
|
|
|
<refpurpose>Calculates the crc32 polynomial of a string</refpurpose>
|
|
|
|
</refnamediv>
|
2007-06-11 00:50:48 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-06-11 00:50:00 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>int</type><methodname>crc32</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>str</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Generates the cyclic redundancy checksum polynomial of 32-bit
|
|
|
|
lengths of the <parameter>str</parameter>. This is usually used
|
|
|
|
to validate the integrity of data being transmitted.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Because PHP's integer type is signed, and many crc32 checksums will
|
|
|
|
result in negative integers, you need to use the "%u" formatter of
|
|
|
|
<function>sprintf</function> or <function>printf</function> to get
|
|
|
|
the string representation of the unsigned crc32 checksum.
|
|
|
|
</para>
|
2007-06-11 00:50:48 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>str</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The data.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-06-11 00:50:00 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>Displaying a crc32 checksum</title>
|
2007-06-11 00:50:48 +00:00
|
|
|
<para>
|
|
|
|
This example shows how to print a converted checksum with the
|
|
|
|
<function>printf</function> function:
|
|
|
|
</para>
|
2007-06-11 00:50:00 +00:00
|
|
|
<programlisting role="php">
|
2003-01-20 04:08:28 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$checksum = crc32("The quick brown fox jumped over the lazy dog.");
|
|
|
|
printf("%u\n", $checksum);
|
|
|
|
?>
|
|
|
|
]]>
|
2007-06-11 00:50:00 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-06-11 00:50:48 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-06-11 00:50:00 +00:00
|
|
|
<para>
|
2007-06-11 00:50:48 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>md5</function></member>
|
|
|
|
<member><function>sha1</function></member>
|
|
|
|
</simplelist>
|
2007-06-11 00:50:00 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-06-11 00:50:48 +00:00
|
|
|
|
2007-06-11 00:50:00 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|