aboutsummaryrefslogtreecommitdiff
path: root/src/hex.php
diff options
context:
space:
mode:
authorcassio <cassiopc@gmail.com>2018-09-04 17:41:02 +0000
committercassio <cassiopc@gmail.com>2018-09-04 17:41:02 +0000
commit6cefeaeb0a2992b48315d253d2528278a6445251 (patch)
treef18f9ae1f6ec2baeaac3d2e84ac3d62ca8a60e29 /src/hex.php
parent807bc8e3764e3204941fa9d5e8f9f504cd06c91e (diff)
downloadboca-6cefeaeb0a2992b48315d253d2528278a6445251.tar.gz
boca-6cefeaeb0a2992b48315d253d2528278a6445251.zip
bug fix padding zeros
Diffstat (limited to 'src/hex.php')
-rw-r--r--src/hex.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hex.php b/src/hex.php
index be7b01e..4e9111d 100644
--- a/src/hex.php
+++ b/src/hex.php
@@ -39,7 +39,7 @@ function encryptData($text,$key,$compress=true) {
$text = zipstr($text);
$grade = '@#';
}
- $crypttext = openssl_encrypt($text . myshorthash($text) . $grade, 'aes-256-cbc', substr(pack("H*", $key),0,32), OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv);
+ $crypttext = openssl_encrypt($text . myshorthash($text) . $grade, 'aes-256-cbc', substr(pack("H*", $key),0,32), OPENSSL_RAW_DATA, $iv);
return base64_encode($crypttext . $iv);
}
@@ -60,7 +60,7 @@ function decryptData($crypttext,$key,$txt='') {
$crypttext = substr($crypttext, 0, $clen-$iv_size);
$key = myhash($key . "123456789012345678901234567890"); // . myhash($key);
- $decrypttext = openssl_decrypt($crypttext, 'aes-256-cbc', substr(pack("H*", $key),0,32), OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv);
+ $decrypttext = openssl_decrypt($crypttext, 'aes-256-cbc', substr(pack("H*", $key),0,32), OPENSSL_RAW_DATA, $iv);
$pos = strrpos($decrypttext,"#");
$iscompressed=false;
if(substr($decrypttext,$pos-1,1)=='@') $iscompressed=true;