Bunkai.Satori
Bunkai.Satori

Reputation: 4758

MySQL AES_ENCRYPT() Length - Formula Explanation

To calculate how much data a person should project for cells containing MySQL AES_ENCRYPT()-ed string, one should use the following formula:

16 * (trunc(string_length / 16) + 1)

The formula itself is not difficult. What I do not understand is the trunc() function. What does that function do, please?

Once I understand that one, it will be easy to calculate suitable length for VARBINARY() cells containing my encrypted data.

Thank you for your explanation.

Upvotes: 1

Views: 1445

Answers (1)

Marc B
Marc B

Reputation: 360782

It's a pseudo-code equivalent of FLOOR or TRUNCATE. e.g. strip the decimals off a division operation.

trunc(5 / 2) -> trunc(2.5) -> 2.

edit - dang... I just can NOT spell "pseudo" correctly today...

Upvotes: 1

Related Questions