Skip to content

Instantly share code, notes, and snippets.

@avraampiperidis
Created June 18, 2013 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avraampiperidis/5808808 to your computer and use it in GitHub Desktop.
Save avraampiperidis/5808808 to your computer and use it in GitHub Desktop.
a php cli md5 encoder!
<?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