-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcombine.phpt
More file actions
82 lines (65 loc) · 1.64 KB
/
combine.phpt
File metadata and controls
82 lines (65 loc) · 1.64 KB
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
--TEST--
combine() test
--EXTENSIONS--
crc_fast
--FILE--
<?php
// checksum CRC-32, binary inputs
$combined = CrcFast\combine(
CrcFast\CRC_32_ISCSI,
CrcFast\hash(CrcFast\CRC_32_ISCSI, '1234', true),
CrcFast\hash(CrcFast\CRC_32_ISCSI, '56789', true),
5,
false
);
var_dump($combined);
// checksum CRC-32, hex inputs
$combined = CrcFast\combine(
CrcFast\CRC_32_ISCSI,
CrcFast\hash(CrcFast\CRC_32_ISCSI, '1234', false),
CrcFast\hash(CrcFast\CRC_32_ISCSI, '56789', false),
5,
false
);
var_dump($combined);
// digest CRC-32
$first = new CrcFast\Digest(CrcFast\CRC_32_ISCSI);
$first->update('1234');
$first->finalize(false);
$second = new CrcFast\Digest(CrcFast\CRC_32_ISCSI);
$second->update('56789');
$first->combine($second);
var_dump($first->finalize(false));
// checksum CRC-64, binary inputs
$combined = CrcFast\combine(
CrcFast\CRC_64_NVME,
CrcFast\hash(CrcFast\CRC_64_NVME, '1234', true),
CrcFast\hash(CrcFast\CRC_64_NVME, '56789', true),
5,
false
);
var_dump($combined);
// checksum CRC-64, hex inputs
$combined = CrcFast\combine(
CrcFast\CRC_64_NVME,
CrcFast\hash(CrcFast\CRC_64_NVME, '1234', false),
CrcFast\hash(CrcFast\CRC_64_NVME, '56789', false),
5,
false
);
var_dump($combined);
// digest CRC-64
$first = new CrcFast\Digest(CrcFast\CRC_64_NVME);
$first->update('1234');
$second = new CrcFast\Digest(CrcFast\CRC_64_NVME);
$second->update('56789');
$first->combine($second);
var_dump($first->finalize(false));
?>
--EXPECT--
string(8) "e3069283"
string(8) "e3069283"
string(8) "e3069283"
string(16) "ae8b14860a799888"
string(16) "ae8b14860a799888"
string(16) "ae8b14860a799888"