php signature dictionary attack
1029 bytes
992 graphemes
37 linefeeds (\n)
<?php // Function to create HMAC-SHA256 hash with a secret function createHash($text, $secret) { // Generate HMAC-SHA256 hash $hash = hash_hmac('sha256', $text, $secret); return $hash; } // Example usage $textToHash = "Hello, World!"; $secretsFile = "secrets.txt"; $knownHash = 'known_hash'; // Replace with your actual known hash // Read potential secrets from the file into an array $potentialSecrets = file($secretsFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($potentialSecrets === false) { die("Unable to read secrets file."); } foreach ($potentialSecrets as $secretKey) { $hashedText = createHash($textToHash, $secretKey); echo "Original Text: $textToHash\n"; echo "Secret Key: $secretKey\n"; echo "Hashed Text: $hashedText\n"; // Check if the hash matches the known hash if ($hashedText === $knownHash) { echo "Match found! Corresponding Secret: $secretKey\n"; } echo "-----------------------------\n"; } ?>