Last active
November 24, 2021 10:20
-
-
Save vbcupu/ff483dc6a95671524719012c8ed7add6 to your computer and use it in GitHub Desktop.
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 | |
require_once 'vendor/autoload.php'; | |
/* function decrypt dan kompresi dijadikan satu */ | |
function stringDecrypt($key, $string) | |
{ | |
$encrypt_method = 'AES-256-CBC'; | |
// hash | |
$key_hash = hex2bin(hash('sha256', $key)); | |
// iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning | |
$iv = substr(hex2bin(hash('sha256', $key)), 0, 16); | |
$output = openssl_decrypt(base64_decode($string), $encrypt_method, $key_hash, OPENSSL_RAW_DATA, $iv); | |
return \LZCompressor\LZString::decompressFromEncodedURIComponent($output); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment