Skip to content

Commit

Permalink
Update Encryption Method
Browse files Browse the repository at this point in the history
  • Loading branch information
eka7a committed Jan 10, 2017
1 parent 238353b commit 9ecceed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions upload/system/library/encryption.php
Expand Up @@ -7,10 +7,10 @@ public function __construct($key) {
}

public function encrypt($value) {
return strtr(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, hash('sha256', $this->key, true), $value, MCRYPT_MODE_ECB)), '+/=', '-_,');
return base64_encode(openssl_encrypt($value, 'AES-256-CBC', hash('sha256', $this->key, true), 0, substr(hash('sha256', $this->key, true), 16, 16)));
}

public function decrypt($value) {
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, hash('sha256', $this->key, true), base64_decode(strtr($value, '-_,', '+/=')), MCRYPT_MODE_ECB));
return openssl_decrypt(base64_decode($value), 'AES-256-CBC', hash('sha256', $this->key, true), 0, substr(hash('sha256', $this->key, true), 16, 16));
}
}
}

0 comments on commit 9ecceed

Please sign in to comment.