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.
69 lines
2.1 KiB
PHP
69 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\QrCode\ErrorCorrection\ReedSolomonEncoder;
|
|
|
|
echo "=== Polynomial Division Fix Test ===\n\n";
|
|
|
|
// Test with simple data
|
|
$data = [1, 2, 3];
|
|
$ecCodewords = 3;
|
|
|
|
$rs = new ReedSolomonEncoder();
|
|
$reflection = new ReflectionClass($rs);
|
|
|
|
// Get generator polynomial
|
|
$getGeneratorMethod = $reflection->getMethod('getGeneratorPolynomial');
|
|
$getGeneratorMethod->setAccessible(true);
|
|
$generator = $getGeneratorMethod->invoke($rs, $ecCodewords);
|
|
|
|
echo "Generator polynomial: " . implode(', ', $generator) . "\n";
|
|
echo "Note: First coefficient is 0, which is unusual.\n\n";
|
|
|
|
// The issue might be that we're using the generator polynomial incorrectly
|
|
// In standard Reed-Solomon, the generator polynomial is monic (leading coefficient = 1)
|
|
// But our stored polynomials start with 0
|
|
|
|
// Let's check if we should skip the first coefficient
|
|
if ($generator[0] === 0) {
|
|
echo "Generator polynomial starts with 0 - this might be the issue.\n";
|
|
echo "In standard RS, generator should be monic (leading coefficient = 1).\n\n";
|
|
|
|
// Try without the first coefficient
|
|
$generatorWithoutZero = array_slice($generator, 1);
|
|
echo "Generator without leading 0: " . implode(', ', $generatorWithoutZero) . "\n";
|
|
echo "This would be a monic polynomial of degree " . (count($generatorWithoutZero) - 1) . "\n\n";
|
|
}
|
|
|
|
// Test the actual encoding
|
|
$ec = $rs->encode($data, $ecCodewords);
|
|
echo "EC codewords: " . implode(', ', $ec) . "\n\n";
|
|
|
|
// Now let's verify with our decoder
|
|
require_once __DIR__ . '/test-reed-solomon-decoder.php';
|
|
|
|
$fullCodeword = array_merge($data, $ec);
|
|
$decoder = new SimpleRSDecoder();
|
|
$syndromes = $decoder->calculateSyndromes($fullCodeword, $ecCodewords);
|
|
|
|
echo "Syndromes: " . implode(', ', $syndromes) . "\n";
|
|
$allZero = true;
|
|
foreach ($syndromes as $s) {
|
|
if ($s !== 0) {
|
|
$allZero = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($allZero) {
|
|
echo "✅ All syndromes are zero - codeword is valid!\n";
|
|
} else {
|
|
echo "❌ Syndromes are not all zero - codeword is invalid!\n";
|
|
echo "\nThe problem is in the polynomial division algorithm.\n";
|
|
}
|
|
|
|
|