src/Pharaoh/PharDiff.php
public function hashChildren(string $algo,string  $dirA, string $dirB)
    {
        /**
         * @var string $a
         * @var string $b
         */
        $a = $b = '';
        $filesA = $this->listAllFiles($dirA);
        $filesB = $this->listAllFiles($dirB);
        $numFiles = \max(\count($filesA), \count($filesB));
        
        // Array of two empty arrays
        $hashes = [[], []];
        for ($i = 0; $i < $numFiles; ++$i) {
            $thisFileA = (string) $filesA[$i];
            $thisFileB = (string) $filesB[$i];
            if (isset($filesA[$i])) {
                $a = \preg_replace('#^'.\preg_quote($dirA, '#').'#', '', $thisFileA);
                if (isset($filesB[$i])) {
                    $b = \preg_replace('#^'.\preg_quote($dirB, '#').'#', '', $thisFileB);
                } else {
                    $b = $a;
                }
            } elseif (isset($filesB[$i])) {
                $b = \preg_replace('#^'.\preg_quote($dirB, '#').'#', '', $thisFileB);
                $a = $b;
            }
            
            if (isset($filesA[$i])) {
                // A exists
                if (\strtolower($algo) === 'blake2b') {
                    $hashes[0][$a] = Hex::encode(\ParagonIE_Sodium_File::generichash($thisFileA));
                } else {
                    $hashes[0][$a] = \hash_file($algo, $thisFileA);
                }
            } elseif (isset($filesB[$i])) {
                // A doesn't exist, B does
                $hashes[0][$a] = '';
            }
            
            if (isset($filesB[$i])) {
                // B exists
                if (\strtolower($algo) === 'blake2b') {
                    $hashes[1][$b] = Hex::encode(\ParagonIE_Sodium_File::generichash($thisFileB));
                } else {
                    $hashes[1][$b] = \hash_file($algo, $thisFileB);
                }
            } elseif (isset($filesA[$i])) {
                // B doesn't exist, A does
                $hashes[1][$b] = '';
            }
        }
        return $hashes;
    }
public function hashChildren(string $algo,string  $dirA, string $dirB)
    {
        /**
         * @var string $a
         * @var string $b
         */
        $a = $b = '';
        $filesA = $this->listAllFiles($dirA);
        $filesB = $this->listAllFiles($dirB);
        $numFiles = \max(\count($filesA), \count($filesB));
        
        // Array of two empty arrays
        $hashes = [[], []];
        for ($i = 0; $i < $numFiles; ++$i) {
            $thisFileA = (string) $filesA[$i];
            $thisFileB = (string) $filesB[$i];
            if (isset($filesA[$i])) {
                $a = \preg_replace('#^'.\preg_quote($dirA, '#').'#', '', $thisFileA);
                if (isset($filesB[$i])) {
                    $b = \preg_replace('#^'.\preg_quote($dirB, '#').'#', '', $thisFileB);
                } else {
                    $b = $a;
                }
            } elseif (isset($filesB[$i])) {
                $b = \preg_replace('#^'.\preg_quote($dirB, '#').'#', '', $thisFileB);
                $a = $b;
            }
            
            if (isset($filesA[$i])) {
                // A exists
                if (\strtolower($algo) === 'blake2b') {
                    $hashes[0][$a] = Hex::encode(\ParagonIE_Sodium_File::generichash($thisFileA));
                } else {
                    $hashes[0][$a] = \hash_file($algo, $thisFileA);
                }
            } elseif (isset($filesB[$i])) {
                // A doesn't exist, B does
                $hashes[0][$a] = '';
            }
            
            if (isset($filesB[$i])) {
                // B exists
                if (\strtolower($algo) === 'blake2b') {
                    $hashes[1][$b] = Hex::encode(\ParagonIE_Sodium_File::generichash($thisFileB));
                } else {
                    $hashes[1][$b] = \hash_file($algo, $thisFileB);
                }
            } elseif (isset($filesA[$i])) {
                // B doesn't exist, A does
                $hashes[1][$b] = '';
            }
        }
        return $hashes;
    }
public function hashChildren ( string $ algo , string $ dirA , string $ dirB ) { /**
         * @var string $a
         * @var string $b
         */ $ a = $ b = '' ; $ filesA = $ this -> listAllFiles ( $ dirA ) ; $ filesB = $ this -> listAllFiles ( $ dirB ) ; $ numFiles = \ max ( \ count ( $ filesA ) , \ count ( $ filesB ) ) ; // Array of two empty arrays $ hashes = [ [ ] , [ ] ] ; for ( $ i = 0 ; $ i < $ numFiles ; ++ $ i ) { $ thisFileA = ( string ) $ filesA [ $ i ] ; $ thisFileB = ( string ) $ filesB [ $ i ] ; if ( isset ( $ filesA [ $ i ] ) ) { $ a = \ preg_replace ( '#^' . \ preg_quote ( $ dirA , '#' ) . '#' , '' , $ thisFileA ) ; if ( isset ( $ filesB [ $ i ] ) ) { $ b = \ preg_replace ( '#^' . \ preg_quote ( $ dirB , '#' ) . '#' , '' , $ thisFileB ) ; } else { $ b = $ a ; } } elseif ( isset ( $ filesB [ $ i ] ) ) { $ b = \ preg_replace ( '#^' . \ preg_quote ( $ dirB , '#' ) . '#' , '' , $ thisFileB ) ; $ a = $ b ; } if ( isset ( $ filesA [ $ i ] ) ) { // A exists if ( \ strtolower ( $ algo ) === 'blake2b' ) { $ hashes [ 0 ] [ $ a ] = Hex :: encode ( \ ParagonIE_Sodium_File :: generichash ( $ thisFileA ) ) ; } else { $ hashes [ 0 ] [ $ a ] = \ hash_file ( $ algo , $ thisFileA ) ; } } elseif ( isset ( $ filesB [ $ i ] ) ) { // A doesn't exist, B does $ hashes [ 0 ] [ $ a ] = '' ; } if ( isset ( $ filesB [ $ i ] ) ) { // B exists if ( \ strtolower ( $ algo ) === 'blake2b' ) { $ hashes [ 1 ] [ $ b ] = Hex :: encode ( \ ParagonIE_Sodium_File :: generichash ( $ thisFileB ) ) ; } else { $ hashes [ 1 ] [ $ b ] = \ hash_file ( $ algo , $ thisFileB ) ; } } elseif ( isset ( $ filesA [ $ i ] ) ) { // B doesn't exist, A does $ hashes [ 1 ] [ $ b ] = '' ; } } return $ hashes ; }
Get hashes of all of the files in the two arrays.

@param string $algo
@param string $dirA
@param string $dirB
@return array<int, array<mixed, string>>
@throws \SodiumException
Get hashes of all of the files in the two arrays .