-
Notifications
You must be signed in to change notification settings - Fork 1
/
crc.php
1452 lines (1302 loc) · 37.2 KB
/
crc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace xenocrat;
class crc {
const VERSION_MAJOR = 2;
const VERSION_MINOR = 3;
const VERSION_PATCH = 0;
const CRC_CHECK_DATA = "123456789";
const CRC8_AUTOSAR_CHECK = 0xdf;
const CRC8_BLUETOOTH_CHECK = 0x26;
const CRC8_CDMA2000_CHECK = 0xda;
const CRC8_DARC_CHECK = 0x15;
const CRC8_DVB_S2_CHECK = 0xbc;
const CRC8_GSM_A_CHECK = 0x37;
const CRC8_GSM_B_CHECK = 0x94;
const CRC8_HITAG_CHECK = 0xb4;
const CRC8_I_432_1_CHECK = 0xa1;
const CRC8_I_CODE_CHECK = 0x7e;
const CRC8_LTE_CHECK = 0xea;
const CRC8_MAXIM_DOW_CHECK = 0xa1;
const CRC8_MIFARE_MAD_CHECK = 0x99;
const CRC8_NRSC_5_CHECK = 0xf7;
const CRC8_OPENSAFETY_CHECK = 0x3e;
const CRC8_ROHC_CHECK = 0xd0;
const CRC8_SAE_J1850_CHECK = 0x4b;
const CRC8_SMBUS_CHECK = 0xf4;
const CRC8_TECH_3250_CHECK = 0x97;
const CRC8_WCDMA_CHECK = 0x25;
const CRC16_A_CHECK = 0xbf05;
const CRC16_ARC_CHECK = 0xbb3d;
const CRC16_CDMA2000_CHECK = 0x4c06;
const CRC16_CMS_CHECK = 0xaee7;
const CRC16_DDS_110_CHECK = 0x9ecf;
const CRC16_DECT_R_CHECK = 0x007e;
const CRC16_DECT_X_CHECK = 0x007f;
const CRC16_DNP_CHECK = 0xea82;
const CRC16_EN_13757_CHECK = 0xc2b7;
const CRC16_GENIBUS_CHECK = 0xd64e;
const CRC16_GSM_CHECK = 0xce3c;
const CRC16_IBM_3740_CHECK = 0x29b1;
const CRC16_IBM_SDLC_CHECK = 0x906e;
const CRC16_KERMIT_CHECK = 0x2189;
const CRC16_LJ1200_CHECK = 0xbdf4;
const CRC16_M17_CHECK = 0x772b;
const CRC16_MAXIM_DOW_CHECK = 0x44c2;
const CRC16_MCRF4XX_CHECK = 0x6f91;
const CRC16_MODBUS_CHECK = 0x4b37;
const CRC16_NRSC_5_CHECK = 0xa066;
const CRC16_OPENSAFETY_A_CHECK = 0x5d38;
const CRC16_OPENSAFETY_B_CHECK = 0x20fe;
const CRC16_PROFIBUS_CHECK = 0xa819;
const CRC16_RIELLO_CHECK = 0x63d0;
const CRC16_SPI_FUJITSU_CHECK = 0xe5cc;
const CRC16_T10_DIF_CHECK = 0xd0db;
const CRC16_TELEDISK_CHECK = 0x0fb3;
const CRC16_TMS37157_CHECK = 0x26b1;
const CRC16_UMTS_CHECK = 0xfee8;
const CRC16_USB_CHECK = 0xb4c8;
const CRC16_XMODEM_CHECK = 0x31c3;
const CRC24_BLE_CHECK = 0xc25a56;
const CRC24_FLEXRAY_A_CHECK = 0x7979bd;
const CRC24_FLEXRAY_B_CHECK = 0x1f23b8;
const CRC24_INTERLAKEN_CHECK = 0xb4f3e6;
const CRC24_LTE_A_CHECK = 0xcde703;
const CRC24_LTE_B_CHECK = 0x23ef52;
const CRC24_OPENPGP_CHECK = 0x21cf02;
const CRC24_OS_9_CHECK = 0x200fa5;
const CRC32_AIXM_CHECK = 0x3010bf7f;
const CRC32_AUTOSAR_CHECK = 0x1697d06a;
const CRC32_BASE91_D_CHECK = 0x87315576;
const CRC32_BZIP2_CHECK = 0xfc891918;
const CRC32_CD_ROM_EDC_CHECK = 0x6ec2edc4;
const CRC32_CKSUM_CHECK = 0x765e7680;
const CRC32_ISCSI_CHECK = 0xe3069283;
const CRC32_ISO_HDLC_CHECK = 0xcbf43926;
const CRC32_JAMCRC_CHECK = 0x340bc6d9;
const CRC32_MEF_CHECK = 0xd2c22f51;
const CRC32_MPEG_2_CHECK = 0x0376e6e7;
const CRC32_XFER_CHECK = 0xbd0be338;
const CRC64_ECMA_182_CHECK = "6c40df5f0b497347";
const CRC64_GO_ISO_CHECK = "b90956c775a41001";
const CRC64_MS_CHECK = "75d4b74f024eceea";
const CRC64_WE_CHECK = "62ec59e3f1a4f00a";
const CRC64_XZ_CHECK = "995dc9bbdf1939fa";
/* CRC-8/AUTOSAR */
public static function crc8_autosar(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x2f,
ini:0xff,
xor:0xff,
ref_in:false,
ref_out:false
);
}
/* CRC-8/BLUETOOTH */
public static function crc8_bluetooth(
$str
): int {
return self::crc8(
str:$str,
polynomial:0xa7,
ini:0x00,
xor:0x00,
ref_in:true,
ref_out:true
);
}
/* CRC-8/CDMA2000 */
public static function crc8_cdma2000(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x9b,
ini:0xff,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/DARC */
public static function crc8_darc(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x39,
ini:0x00,
xor:0x00,
ref_in:true,
ref_out:true
);
}
/* CRC-8/DVB-S2 */
public static function crc8_dvb_s2(
$str
): int {
return self::crc8(
str:$str,
polynomial:0xd5,
ini:0x00,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/GSM-A */
public static function crc8_gsm_a(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x1d,
ini:0x00,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/GSM-B */
public static function crc8_gsm_b(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x49,
ini:0x00,
xor:0xff,
ref_in:false,
ref_out:false
);
}
/* CRC-8/HITAG */
public static function crc8_hitag(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x1d,
ini:0xff,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/I-432-1 */
public static function crc8_i_432_1(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x07,
ini:0x00,
xor:0x55,
ref_in:false,
ref_out:false
);
}
/* CRC-8/I-CODE */
public static function crc8_i_code(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x1d,
ini:0xfd,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/LTE */
public static function crc8_lte(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x9b,
ini:0x00,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/MAXIM-DOW */
public static function crc8_maxim_dow(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x31,
ini:0x00,
xor:0x00,
ref_in:true,
ref_out:true
);
}
/* CRC-8/MIFARE-MAD */
public static function crc8_mifare_mad(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x1d,
ini:0xc7,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/NRSC-5 */
public static function crc8_nrsc_5(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x31,
ini:0xff,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/OPENSAFETY */
public static function crc8_opensafety(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x2f,
ini:0x00,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/ROHC */
public static function crc8_rohc(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x07,
ini:0xff,
xor:0x00,
ref_in:true,
ref_out:true
);
}
/* CRC-8/SAE-J1850 */
public static function crc8_sae_j1850(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x1d,
ini:0xff,
xor:0xff,
ref_in:false,
ref_out:false
);
}
/* CRC-8/SMBUS */
public static function crc8_smbus(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x07,
ini:0x00,
xor:0x00,
ref_in:false,
ref_out:false
);
}
/* CRC-8/TECH-3250 */
public static function crc8_tech_3250(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x1d,
ini:0xff,
xor:0x00,
ref_in:true,
ref_out:true
);
}
/* CRC-8/WCDMA */
public static function crc8_wcdma(
$str
): int {
return self::crc8(
str:$str,
polynomial:0x9b,
ini:0x00,
xor:0x00,
ref_in:true,
ref_out:true
);
}
/* CRC-16/ISO-IEC-14443-3-A */
public static function crc16_a(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0xc6c6,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/ARC */
public static function crc16_arc(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0x0000,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/CDMA2000 */
public static function crc16_cdma2000(
$str
): int {
return self::crc16(
str:$str,
polynomial:0xc867,
ini:0xffff,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/CMS */
public static function crc16_cms(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0xffff,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/DDS-110 */
public static function crc16_dds_110(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0x800d,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/DECT-R */
public static function crc16_dect_r(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x0589,
ini:0x0000,
xor:0x0001,
ref_in:false,
ref_out:false
);
}
/* CRC-16/DECT-X */
public static function crc16_dect_x(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x0589,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/DNP */
public static function crc16_dnp(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x3d65,
ini:0x0000,
xor:0xffff,
ref_in:true,
ref_out:true
);
}
/* CRC-16/EN-13757 */
public static function crc16_en_13757(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x3d65,
ini:0x0000,
xor:0xffff,
ref_in:false,
ref_out:false
);
}
/* CRC-16/GENIBUS */
public static function crc16_genibus(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0xffff,
xor:0xffff,
ref_in:false,
ref_out:false
);
}
/* CRC-16/GSM */
public static function crc16_gsm(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0x0000,
xor:0xffff,
ref_in:false,
ref_out:false
);
}
/* CRC-16/IBM-3740 */
public static function crc16_ibm_3740(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0xffff,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/IBM-SDLC */
public static function crc16_ibm_sdlc(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0xffff,
xor:0xffff,
ref_in:true,
ref_out:true
);
}
/* CRC-16/KERMIT */
public static function crc16_kermit(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0x0000,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/LJ1200 */
public static function crc16_lj1200(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x6f63,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/M17 */
public static function crc16_m17(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x5935,
ini:0xffff,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/MAXIM-DOW */
public static function crc16_maxim_dow(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0x0000,
xor:0xffff,
ref_in:true,
ref_out:true
);
}
/* CRC-16/MCRF4XX */
public static function crc16_mcrf4xx(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0xffff,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/MODBUS */
public static function crc16_modbus(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0xffff,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/NRSC-5 */
public static function crc16_nrsc_5(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x080b,
ini:0xffff,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/OPENSAFETY-A */
public static function crc16_opensafety_a(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x5935,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/OPENSAFETY-B */
public static function crc16_opensafety_b(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x755b,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/PROFIBUS */
public static function crc16_profibus(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1dcf,
ini:0xffff,
xor:0xffff,
ref_in:false,
ref_out:false
);
}
/* CRC-16/RIELLO */
public static function crc16_riello(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0xb2aa,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/SPI-FUJITSU */
public static function crc16_spi_fujitsu(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0x1d0f,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/T10-DIF */
public static function crc16_t10_dif(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8bb7,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/TELEDISK */
public static function crc16_teledisk(
$str
): int {
return self::crc16(
str:$str,
polynomial:0xa097,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/TMS37157 */
public static function crc16_tms37157(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0x89ec,
xor:0x0000,
ref_in:true,
ref_out:true
);
}
/* CRC-16/UMTS */
public static function crc16_umts(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-16/USB */
public static function crc16_usb(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x8005,
ini:0xffff,
xor:0xffff,
ref_in:true,
ref_out:true
);
}
/* CRC-16/XMODEM */
public static function crc16_xmodem(
$str
): int {
return self::crc16(
str:$str,
polynomial:0x1021,
ini:0x0000,
xor:0x0000,
ref_in:false,
ref_out:false
);
}
/* CRC-24/BLE */
public static function crc24_ble(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x00065b,
ini:0x555555,
xor:0x000000,
ref_in:true,
ref_out:true
);
}
/* CRC-24/FLEXRAY-A */
public static function crc24_flexray_a(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x5d6dcb,
ini:0xfedcba,
xor:0x000000,
ref_in:false,
ref_out:false
);
}
/* CRC-24/FLEXRAY-B */
public static function crc24_flexray_b(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x5d6dcb,
ini:0xabcdef,
xor:0x000000,
ref_in:false,
ref_out:false
);
}
/* CRC-24/INTERLAKEN */
public static function crc24_interlaken(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x328b63,
ini:0xffffff,
xor:0xffffff,
ref_in:false,
ref_out:false
);
}
/* CRC-24/LTE-A */
public static function crc24_lte_a(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x864cfb,
ini:0x000000,
xor:0x000000,
ref_in:false,
ref_out:false
);
}
/* CRC-24/LTE-B */
public static function crc24_lte_b(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x800063,
ini:0x000000,
xor:0x000000,
ref_in:false,
ref_out:false
);
}
/* CRC-24/OPENPGP */
public static function crc24_openpgp(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x864cfb,
ini:0xb704ce,
xor:0x000000,
ref_in:false,
ref_out:false
);
}
/* CRC-24/OS-9 */
public static function crc24_os_9(
$str
): int {
return self::crc24(
str:$str,
polynomial:0x800063,
ini:0xffffff,
xor:0xffffff,
ref_in:false,
ref_out:false
);
}
/* CRC-32/AIXM */
public static function crc32_aixm(
$str
): int {
return self::crc32(
str:$str,
polynomial:0x814141ab,
ini:0x00000000,
xor:0x00000000,
ref_in:false,
ref_out:false
);
}
/* CRC-32/AUTOSAR */
public static function crc32_autosar(
$str
): int {
return self::crc32(
str:$str,
polynomial:0xf4acfb13,
ini:0xffffffff,
xor:0xffffffff,
ref_in:true,
ref_out:true
);
}
/* CRC-32/BASE91-D */
public static function crc32_base91_d(
$str
): int {
return self::crc32(
str:$str,
polynomial:0xa833982b,
ini:0xffffffff,
xor:0xffffffff,
ref_in:true,
ref_out:true
);
}
/* CRC-32/BZIP2 */
public static function crc32_bzip2(
$str
): int {
return self::crc32(
str:$str,
polynomial:0x04c11db7,
ini:0xffffffff,
xor:0xffffffff,
ref_in:false,
ref_out:false
);
}
/* CRC-32/CD-ROM-EDC */
public static function crc32_cd_rom_edc(
$str
): int {
return self::crc32(
str:$str,
polynomial:0x8001801b,
ini:0x00000000,
xor:0x00000000,
ref_in:true,
ref_out:true
);
}
/* CRC-32/CKSUM */
public static function crc32_cksum(
$str
): int {
return self::crc32(
str:$str,
polynomial:0x04c11db7,
ini:0x00000000,
xor:0xffffffff,
ref_in:false,
ref_out:false
);
}