Created
June 18, 2013 20:05
-
-
Save avraampiperidis/5808808 to your computer and use it in GitHub Desktop.
a php cli md5 encoder!
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 | |
$key = 'zeron'; | |
echo ' |--------welcome to Protectsoft---------| '."\n"; | |
fwrite(STDOUT, "enter your keyword: "); | |
$passwd = trim(fgets(STDIN)); | |
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $passwd, MCRYPT_MODE_CBC, md5(md5($key)))); | |
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); | |
echo 'Encrypted:' . "\n"; | |
var_dump($encrypted); | |
echo "\n"; | |
echo 'Decrypted:' . "\n"; | |
var_dump($decrypted); // " string to be encrypted " | |
echo ' |--------welcome to Protectsoft---------| '."\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment