Skip to content

Instantly share code, notes, and snippets.

@alordiel
Created February 21, 2018 13:56
Show Gist options
  • Save alordiel/66147d204ffd723949ff92745039e6f7 to your computer and use it in GitHub Desktop.
Save alordiel/66147d204ffd723949ff92745039e6f7 to your computer and use it in GitHub Desktop.
PHP custom crypt and decrypt function
//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