Rohan
Rohan

Reputation: 383

What range of characters can PHP's openssl_encrypt() output using AES-256-cbc?

I'm using PHP's openssl_encrypt(), and I was wondering what the set of all possible output characters is when the encryption method is AES-256-cbc? Thanks for any help you can provide!

Upvotes: 2

Views: 3143

Answers (1)

sagi
sagi

Reputation: 5757

According to the documentation:

returns a raw or base64 encoded string

This is determined by the 4th parameter: $raw_output

Setting to TRUE will return as raw output data, otherwise the return value is base64 encoded.

Therefore, if you set $raw_output to TRUE, then raw binary is returned, meaning any character is possible. If you don't set it (or set it to false), then a base64 string is returned, meaning the possible characters are A-Z, a-z, 0-9, +, / and =.

Upvotes: 3

Related Questions