|
@@ 177-184 (lines=8) @@
|
| 174 |
|
} |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
private function encrypt($data, $key) { |
| 178 |
|
$salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
| 179 |
|
$key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
| 180 |
|
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
| 181 |
|
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
| 182 |
|
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_ECB, $iv)); |
| 183 |
|
return $encrypted; |
| 184 |
|
} |
| 185 |
|
private function decrypt($data, $key) { |
| 186 |
|
$salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
| 187 |
|
$key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
|
@@ 185-192 (lines=8) @@
|
| 182 |
|
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_ECB, $iv)); |
| 183 |
|
return $encrypted; |
| 184 |
|
} |
| 185 |
|
private function decrypt($data, $key) { |
| 186 |
|
$salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
| 187 |
|
$key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
| 188 |
|
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
| 189 |
|
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
| 190 |
|
$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($data), MCRYPT_MODE_ECB, $iv); |
| 191 |
|
return $decrypted; |
| 192 |
|
} |
| 193 |
|
|
| 194 |
|
} |
| 195 |
|
|