<?php
require 'vendor/autoload.php';
use Base32\Base32;

$storedSecret = 'JJBFGV2ZGNCFARKIKBFTGUCYKA======'; // Replace with actual stored secret

// Decode and Re-Encode for Verification
$decoded = Base32::decode($storedSecret);
$reEncoded = Base32::encode($decoded);

echo "Stored Secret (Base32): " . $storedSecret . "<br>";
echo "Decoded Secret (Hex): " . bin2hex($decoded) . "<br>";
echo "Re-Encoded Secret (Base32): " . $reEncoded . "<br>";

// Check if they match
if ($storedSecret === $reEncoded) {
    echo "✅ Base32 encoding is correct!<br>";
} else {
    echo "❌ Base32 encoding MISMATCH!<br>";
}
?>
