This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
uphp:functions:aes_encrypt [2019/08/16 06:40] admin created |
uphp:functions:aes_encrypt [2021/09/13 05:57] (current) |
||
|---|---|---|---|
| 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 | ||
| Line 96: | Line 100: | ||
| ====See Also==== | ====See Also==== | ||
| - | [[aes_decrypt()]] - Decrypt data using the AES algorithm</ | + | [[aes_decrypt()]] - Decrypt data using the AES algorithm |