Created
May 3, 2020 19:13
-
-
Save ctkqiang/d6492ea9a21a5c8793d30532d9bfa741 to your computer and use it in GitHub Desktop.
Hey guys am i doing it right or wrong? My intention is to decode hashes I just encoded of an image. How do I decode ? My code Need review ::
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// My intention is to decodeencrypted image hashes | |
// and export back to File(image.extension) | |
echo "Decrypt {string} or {file}? [input: \"str\" || \"bin\", type \"exit()\" for quit the programme]"; | |
$__userInputOption = rtrim(fgets(STDIN)); | |
if ($__userInputOption == "str"){ | |
echo "Please enter {string} you want to decode: \n"; | |
$_input = rtrim(fgets(STDIN)); | |
$_encodedString = base64_decode($_input); | |
echo "Encoded String: ".$_input."\n"; | |
echo "Decoded String: ".$_encodedString; | |
} else if ($__userInputOption == "exit()") { | |
exit(); | |
} else if ($__userInputOption == "bin") { | |
echo "Please enter {binary} you want to decode: \n"; | |
$__userInputBinary = rtrim(fgets(STDIN)); | |
$__post_decryption = file_get_contents($__userInputBinary); | |
$__decryptedData = base64_decode($__post_decryption); | |
// echo "Original binary".$__userInputBinary; | |
echo "Decrypted binary hashes: ".$__decryptedData; | |
} else { | |
printf("Please enter a valid input"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment