Created
November 5, 2018 17:37
-
-
Save aprakasa/83ba7d7b419d2aa27646eecbdcfc3ba5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Encrypt Text | |
* @link https://shellcreeper.com/?p=2082 | |
*/ | |
function my_encrypt( $plain_text ){ | |
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); | |
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); | |
$h_key = hash('sha256', wp_salt(), TRUE); | |
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $h_key, $plain_text, MCRYPT_MODE_ECB, $iv)); | |
} | |
/** | |
* Decrypt Text | |
* @link https://shellcreeper.com/?p=2082 | |
*/ | |
function my_decrypt( $encrypted_text ){ | |
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); | |
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); | |
$h_key = hash('sha256', wp_salt(), TRUE); | |
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $h_key, base64_decode( $encrypted_text ), MCRYPT_MODE_ECB, $iv)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment