This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
uphp:functions:aes_decrypt [2019/08/16 06:41] admin [See Also] |
uphp:functions:aes_decrypt [2019/08/16 08:24] admin |
||
---|---|---|---|
Line 76: | Line 76: | ||
$base64_decrypted = base64_decode($base64_encrypted); | $base64_decrypted = base64_decode($base64_encrypted); | ||
| | ||
- | // we will use the calculated length from the encryption | + | // we will calculated |
- | // may not yield a valid result if the encrypted string has a zero in it. | + | // one as the strlen() function may not yield a valid result if the encrypted string |
+ | // has a zero in it. As base64 is 6 bits and our data is 8, we just need to multiply | ||
+ | // the the length by 6/8 or 0.75 to get the base64-decoded size. | ||
+ | |||
+ | $len = intval(strlen($base64_encrypted) * 0.75); | ||
| | ||
// decryption | // decryption |