Created
October 29, 2018 11:07
-
-
Save ajepe/bb824f52817d6c9958d0ece0097c727b to your computer and use it in GitHub Desktop.
3desencyption
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 | |
/** | |
* Created by PhpStorm. | |
* User: Raihan | |
* Date: 10-Jul-17 | |
* Time: 4:37 AM | |
*/ | |
class CryptOpenssl{ | |
private $hash; | |
function __construct($hash){ | |
$key = md5($hash,TRUE); | |
$key .= substr($key,0,8); | |
$this->hash = $key; | |
} | |
/** | |
* @param $data | |
* @return string | |
*/ | |
public function Encrypt($data){ | |
$encData = openssl_encrypt($data, 'DES-EDE3', $this->hash, OPENSSL_RAW_DATA); | |
$encData = base64_encode($encData); | |
return $encData; | |
} | |
/** | |
* @param $data | |
* @return string | |
*/ | |
public function Decrypt($data){ | |
$data = base64_decode($data); | |
$decData = openssl_decrypt($data, 'DES-EDE3', $this->hash, OPENSSL_RAW_DATA); | |
return $decData; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment