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.
71 lines
2.4 KiB
PHP
71 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
echo "=== Bit Mapping Analysis ===\n\n";
|
|
|
|
$testData = 'HELLO WORLD';
|
|
|
|
// Build encoding
|
|
$bits = '';
|
|
|
|
// 1. Mode (4 bits)
|
|
$modeBits = '0100';
|
|
$bits .= $modeBits;
|
|
echo "Bits 0-3: Mode = {$modeBits}\n";
|
|
|
|
// 2. Count (8 bits)
|
|
$countBits = str_pad(decbin(11), 8, '0', STR_PAD_LEFT);
|
|
$bits .= $countBits;
|
|
echo "Bits 4-11: Count = {$countBits} (11)\n";
|
|
|
|
// 3. Data bytes
|
|
$bitPos = 12;
|
|
for ($i = 0; $i < 11; $i++) {
|
|
$char = $testData[$i];
|
|
$byte = ord($char);
|
|
$byteBits = str_pad(decbin($byte), 8, '0', STR_PAD_LEFT);
|
|
$bits .= $byteBits;
|
|
echo "Bits {$bitPos}-" . ($bitPos + 7) . ": '{$char}' = {$byteBits} ({$byte})\n";
|
|
$bitPos += 8;
|
|
}
|
|
|
|
echo "\nTotal bits: " . strlen($bits) . "\n";
|
|
echo "Expected: 4 + 8 + 88 = 100 bits\n\n";
|
|
|
|
// Now check what codeword 11 should be
|
|
// Codeword 11 = Bits 80-87
|
|
echo "=== Codeword 11 Analysis ===\n";
|
|
echo "Bits 80-87 should be: " . substr($bits, 80, 8) . "\n";
|
|
echo "This is character: '" . $testData[8] . "' (bit position " . (80 - 12) . " in data)\n";
|
|
echo "Character index: " . intval(($bitPos - 12 - 8) / 8) . "\n";
|
|
|
|
// Expected codeword 11
|
|
$expected = [64, 180, 132, 84, 196, 196, 242, 5, 116, 245, 174, 59, 64, 109, 236, 233];
|
|
echo "Expected codeword 11: " . $expected[10] . " = " . str_pad(decbin($expected[10]), 8, '0', STR_PAD_LEFT) . "\n";
|
|
echo "Our codeword 11 (bits 80-87): " . bindec(substr($bits, 80, 8)) . " = " . substr($bits, 80, 8) . "\n";
|
|
|
|
// The issue: Our bits 80-87 should be "R" (01010010), but expected is 174 (10101110)
|
|
// This means the expected encoding is different!
|
|
|
|
// Let's check what character should be at bit 80
|
|
// Bit 80 = bit 68 in data (80 - 12 mode/count bits)
|
|
// Data bit 68 = character index 68/8 = 8.5, so it's in the middle of character 8
|
|
// Character 8 = 'R' (bits 68-75 of data = bits 80-87 total)
|
|
|
|
echo "\nCharacter at data position 8: '{$testData[8]}' = " . str_pad(decbin(ord($testData[8])), 8, '0', STR_PAD_LEFT) . "\n";
|
|
echo "Expected codeword 11: " . str_pad(decbin($expected[10]), 8, '0', STR_PAD_LEFT) . "\n";
|
|
|
|
if (substr($bits, 80, 8) === str_pad(decbin($expected[10]), 8, '0', STR_PAD_LEFT)) {
|
|
echo "✅ Codeword 11 matches expected!\n";
|
|
} else {
|
|
echo "❌ Codeword 11 doesn't match!\n";
|
|
echo "This means the expected reference might be wrong, OR\n";
|
|
echo "the data encoding includes something we're missing.\n";
|
|
}
|
|
|
|
// Wait - maybe "HELLO WORLD" in the reference uses a different encoding?
|
|
// Or maybe there's ECI mode or something else?
|
|
|
|
|