-
-
Save IP-CAM/10e8ce676b3d99d1224e968c8af85ddc to your computer and use it in GitHub Desktop.
opencart 1.5.6.4 PHP 7.2+
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 | |
final class Encryption { | |
private $key; | |
public function __construct($key) { | |
$this->key = hash('sha256', $key, true); | |
} | |
public function encrypt($value) { | |
return strtr(base64_encode(openssl_encrypt($value, 'aes-128-cbc', $this->key)), '+/=', '-_,'); | |
} | |
public function decrypt($value) { | |
return trim(openssl_decrypt(base64_decode(strtr($value, '-_,', '+/=')), 'aes-128-cbc', $this->key)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment