Created
June 23, 2018 12:21
-
-
Save py7hon/625ca869d4b8ee67636ae55038fabae0 to your computer and use it in GitHub Desktop.
PHP MD5 Encryption and Decryption
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 | |
$input = $_POST["pass"]; | |
$encrypted = encryptIt( $input ); | |
$decrypted = decryptIt( $encrypted ); | |
echo $encrypted . '<br />' . $decrypted; | |
function encryptIt( $q ) { | |
$cryptKey = 'Kontolnee!!!'; | |
$qEncoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) ); | |
return( $qEncoded ); | |
} | |
function decryptIt( $q ) { | |
$cryptKey = 'Kontolnee!!!'; | |
$qDecoded = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0"); | |
return( $qDecoded ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment