Remove WireGuard integration from production deployment to simplify infrastructure: - Remove docker-compose-direct-access.yml (VPN-bound services) - Remove VPN-only middlewares from Grafana, Prometheus, Portainer - Remove WireGuard middleware definitions from Traefik - Remove WireGuard IPs (10.8.0.0/24) from Traefik forwarded headers All monitoring services now publicly accessible via subdomains: - grafana.michaelschiemer.de (with Grafana native auth) - prometheus.michaelschiemer.de (with Basic Auth) - portainer.michaelschiemer.de (with Portainer native auth) All services use Let's Encrypt SSL certificates via Traefik.
62 lines
2.2 KiB
PHP
62 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\QrCode\ErrorCorrection\ReedSolomonEncoder;
|
|
|
|
echo "=== Reed-Solomon Algorithm Verification ===\n\n";
|
|
|
|
// Test with simple known data
|
|
$testData = [1, 2, 3, 4, 5];
|
|
$ecCodewords = 5;
|
|
|
|
echo "Test data: " . implode(', ', $testData) . "\n";
|
|
echo "EC codewords: {$ecCodewords}\n\n";
|
|
|
|
$reedSolomon = new ReedSolomonEncoder();
|
|
$ec = $reedSolomon->encode($testData, $ecCodewords);
|
|
|
|
echo "EC codewords generated: " . implode(', ', $ec) . "\n\n";
|
|
|
|
// Verify: For RS codes, the message polynomial evaluated at generator roots should be zero
|
|
// But we need the decoder for that. For now, let's verify the algorithm structure.
|
|
|
|
echo "=== Algorithm Verification ===\n";
|
|
echo "Reed-Solomon encoding algorithm:\n";
|
|
echo "1. Create message polynomial: m(x) = data + zeros\n";
|
|
echo "2. Multiply message by x^t (shift left by t positions)\n";
|
|
echo "3. Divide by generator polynomial g(x)\n";
|
|
echo "4. EC codewords = remainder\n\n";
|
|
|
|
// Check if our implementation does this correctly
|
|
$reflection = new ReflectionClass($reedSolomon);
|
|
$encodeMethod = $reflection->getMethod('encode');
|
|
$getGeneratorMethod = $reflection->getMethod('getGeneratorPolynomial');
|
|
$getGeneratorMethod->setAccessible(true);
|
|
|
|
$generator = $getGeneratorMethod->invoke($reedSolomon, $ecCodewords);
|
|
|
|
echo "Generator polynomial (degree {$ecCodewords}): " . implode(', ', $generator) . "\n";
|
|
echo "Coefficient count: " . count($generator) . " (expected: " . ($ecCodewords + 1) . ")\n\n";
|
|
|
|
// The key issue: In our implementation, we're doing polynomial division
|
|
// But we need to verify that the algorithm is correct.
|
|
|
|
echo "=== Potential Issue ===\n";
|
|
echo "The Reed-Solomon encoding in QR codes uses:\n";
|
|
echo " - Message polynomial: m(x) = data codewords\n";
|
|
echo " - Shift: m(x) * x^t (where t = number of EC codewords)\n";
|
|
echo " - Division: (m(x) * x^t) / g(x)\n";
|
|
echo " - EC = remainder\n\n";
|
|
|
|
echo "Our implementation:\n";
|
|
echo " - Creates message polynomial with zeros: [data, 0, 0, ..., 0]\n";
|
|
echo " - Performs polynomial division\n";
|
|
echo " - Returns last t coefficients as EC codewords\n\n";
|
|
|
|
echo "This should be correct, but let's verify the polynomial division algorithm.\n";
|
|
|
|
|