Created
February 21, 2018 13:56
-
-
Save alordiel/66147d204ffd723949ff92745039e6f7 to your computer and use it in GitHub Desktop.
PHP custom crypt and decrypt function
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
//Source: https://stackoverflow.com/questions/15194663/encrypt-and-decrypt-md5 | |
function encryptIt( $q ) { | |
$cryptKey = 'блалалаѝк777амайка'; | |
$qEncoded = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) ); | |
return( $qEncoded ); | |
} | |
function decryptIt( $q ) { | |
$cryptKey = 'блалалаѝк777амайка'; | |
$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