private static function expand56BitKeyTo64BitKey($string_key, $set_parity = true)
    {
        $byte_array_56 = new SplFixedArray(7);
        $byte_array_64 = new SplFixedArray(8);
        $key_64bit = '';

        // Get the byte value of each ASCII character in the string
        for ($i = 0; $i < $byte_array_56->getSize(); $i++) {
            $byte_array_56[$i] = isset($string_key[$i]) ? ord($string_key[$i]) : 0;
        }

        $byte_array_64[0] = $byte_array_56[0] & 254;
        $byte_array_64[1] = ($byte_array_56[0] << 7) | ($byte_array_56[1] >> 1);
        $byte_array_64[2] = ($byte_array_56[1] << 6) | ($byte_array_56[2] >> 2);
        $byte_array_64[3] = ($byte_array_56[2] << 5) | ($byte_array_56[3] >> 3);
        $byte_array_64[4] = ($byte_array_56[3] << 4) | ($byte_array_56[4] >> 4);
        $byte_array_64[5] = ($byte_array_56[4] << 3) | ($byte_array_56[5] >> 5);
        $byte_array_64[6] = ($byte_array_56[5] << 2) | ($byte_array_56[6] >> 6);
        $byte_array_64[7] = $byte_array_56[6] << 1;

        foreach ($byte_array_64 as $byte_val) {
            // Optionally set parity for each byte
            $byte_val = $set_parity ? self::setParityBit($byte_val) : $byte_val;

            $key_64bit .= chr($byte_val);
        }

        return $key_64bit;
    }