Warning: file_put_contents(): Only -1 of 44 bytes written, possibly out of free disk space in /var/www/html/index.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:3) in /var/www/html/cache.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:3) in /var/www/html/cache.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:3) in /var/www/html/cache.php on line 25
count_chars crypt Strings (αλφαριθμητικά) PHP Manual crc32 (PHP 4 >= 4.0.1, 5) — Υπολογίζει το πολυώνυμο ενός string Περιγραφή int ( $str ) Πα...
Forum und email

crc32

(PHP 4 >= 4.0.1, PHP 5)

crc32 — Υπολογίζει το πολυώνυμο crc32 ενός string

Περιγραφή

int crc32 ( string $str )

Παράγει το cyclic redundancy checksum πολυώνυμο, μήκους 32-bit, της παραμέτρουstr . Αυτή η λειτουργία χρησιμοποιείται συνήθως για τον έλεγχο της ακεραιότητας των δεδομένων που μεταδίδονται.

Επειδή ο τύπος δοδμένων integer της PHP είναι προσημασμένος, και πολλά crc32 checksums έχουν ως αποτέλεσμα αρνητικά προσημασμένους integers, είναι απαραίτητο να χρησιμοποιείτε την προδιαγραφή μορφοποίησης "%u" της συνάρτησης sprintf() ή της printf() για να παίρνετε την αναπαράσταση σε string του μη προσημασμένου crc32 checksum.

Το ακόλουθο παράδειγμα δείχνει πώς μπορείτε να εμφανίζετε το μετατρεμμένο checksum με τη συνάρτηση printf():

Example#1 Εμφάνιση ενός crc32 checksum

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

Ανατρέξτε επίσης στις: md5() και sha1().