File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 - name : Get the extension matrix
2020 id : extension-matrix
2121 uses : php/php-windows-builder/extension-matrix@v1
22+ with :
23+ php-version-list : ' 8.1'
2224 build :
2325 needs : get-extension-matrix
2426 runs-on : ${{ matrix.os }}
Original file line number Diff line number Diff line change @@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/multi.part1.rar');
99$ entries = rar_list ($ rar_file1 );
1010echo count ($ entries )." files: \n\n" ;
1111//var_dump($entries);
12- function int32_to_hex ($ value ) {
13- $ value &= 0xffffffff ;
14- return str_pad (strtoupper (dechex ($ value )), 8 , "0 " , STR_PAD_LEFT );
15- }
1612foreach ($ entries as $ e ) {
1713 $ stream = $ e ->getStream ();
1814 if ($ stream === false ) {
@@ -25,7 +21,7 @@ foreach ($entries as $e) {
2521 $ a .= fread ($ stream , 8192 );
2622 }
2723 echo strlen ($ a )." bytes, CRC " ;
28- echo int32_to_hex ( crc32 ( $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
24+ echo strtoupper ( hash ( " crc32b " , $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
2925}
3026
3127echo "Done \n" ;
Original file line number Diff line number Diff line change @@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/store_method.rar');
99$ entries = rar_list ($ rar_file1 );
1010echo count ($ entries )." files: \n\n" ;
1111//var_dump($entries);
12- function int32_to_hex ($ value ) {
13- $ value &= 0xffffffff ;
14- return str_pad (strtoupper (dechex ($ value )), 8 , "0 " , STR_PAD_LEFT );
15- }
1612foreach ($ entries as $ e ) {
1713 $ stream = $ e ->getStream ();
1814 echo $ e ->getName ().": " ;
@@ -21,7 +17,7 @@ foreach ($entries as $e) {
2117 $ a .= fread ($ stream , 512 );
2218 }
2319 echo strlen ($ a )." bytes, CRC " ;
24- echo int32_to_hex ( crc32 ( $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
20+ echo strtoupper ( hash ( " crc32b " , $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
2521}
2622
2723echo "Done \n" ;
Original file line number Diff line number Diff line change @@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/solid.rar');
99$ entries = rar_list ($ rar_file1 );
1010echo count ($ entries )." files: \n\n" ;
1111//var_dump($entries);
12- function int32_to_hex ($ value ) {
13- $ value &= 0xffffffff ;
14- return str_pad (strtoupper (dechex ($ value )), 8 , "0 " , STR_PAD_LEFT );
15- }
1612foreach ($ entries as $ e ) {
1713 $ stream = $ e ->getStream ();
1814 echo $ e ->getName ().": " ;
@@ -21,7 +17,7 @@ foreach ($entries as $e) {
2117 $ a .= fread ($ stream , 8192 );
2218 }
2319 echo strlen ($ a )." bytes, CRC " ;
24- echo int32_to_hex ( crc32 ( $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
20+ echo strtoupper ( hash ( " crc32b " , $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
2521}
2622
2723echo "Done \n" ;
Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ function resolve($vol) {
1010 else
1111 return null ;
1212}
13- function int32_to_hex ($ value ) {
14- $ value &= 0xffffffff ;
15- return str_pad (strtoupper (dechex ($ value )), 8 , "0 " , STR_PAD_LEFT );
16- }
1713$ rar_file1 = rar_open (dirname (__FILE__ ).'/multi_broken.part1.rar ' , null , 'resolve ' );
1814foreach ($ rar_file1 as $ e ) {
1915 $ stream = $ e ->getStream ();
@@ -23,7 +19,7 @@ foreach ($rar_file1 as $e) {
2319 $ a .= fread ($ stream , 8192 );
2420 }
2521 echo strlen ($ a )." bytes, CRC " ;
26- echo int32_to_hex ( crc32 ( $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
22+ echo strtoupper ( hash ( " crc32b " , $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
2723}
2824
2925echo "Done \n" ;
Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ function resolve($vol) {
1010 else
1111 return null ;
1212}
13- function int32_to_hex ($ value ) {
14- $ value &= 0xffffffff ;
15- return str_pad (strtoupper (dechex ($ value )), 8 , "0 " , STR_PAD_LEFT );
16- }
1713echo "Fail: \n" ;
1814$ rar_file1 = rar_open (dirname (__FILE__ ).'/multi_broken.part1.rar ' );
1915$ entry = $ rar_file1 ->getEntry ('file2.txt ' );
@@ -22,7 +18,7 @@ echo "\nSuccess:\n";
2218$ rar_file1 = rar_open (dirname (__FILE__ ).'/multi_broken.part1.rar ' , null , 'resolve ' );
2319$ entry = $ rar_file1 ->getEntry ('file2.txt ' );
2420$ entry ->extract (null , dirname (__FILE__ ) . "/temp_file2.txt " );
25- echo int32_to_hex ( crc32 ( file_get_contents (dirname (__FILE__ ) . "/temp_file2.txt " )));
21+ echo strtoupper ( hash ( " crc32b " , file_get_contents (dirname (__FILE__ ) . "/temp_file2.txt " )));
2622echo "\n" ;
2723echo "Done \n" ;
2824?>
Original file line number Diff line number Diff line change @@ -11,17 +11,13 @@ function resolve($vol) {
1111 else
1212 return null ;
1313}
14- function int32_to_hex ($ value ) {
15- $ value &= 0xffffffff ;
16- return str_pad (strtoupper (dechex ($ value )), 8 , "0 " , STR_PAD_LEFT );
17- }
1814$ stream = fopen ("rar:// " .
1915 dirname (__FILE__ ) . '/multi_broken.part1.rar ' .
2016 "#file2.txt " , "r " , false ,
2117 stream_context_create (array ('rar ' =>array ('volume_callback ' =>'resolve ' ))));
2218$ a = stream_get_contents ($ stream );
2319echo strlen ($ a )." bytes, CRC " ;
24- echo int32_to_hex ( crc32 ( $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
20+ echo strtoupper ( hash ( " crc32b " , $ a ))."\n\n" ; //you can confirm they're equal to those given by $e->getCrc()
2521echo "Done. \n" ;
2622--EXPECTF --
272317704 bytes, CRC F2C79881
You can’t perform that action at this time.
0 commit comments