function encryption_get_cipher_algorithm

6.x encryption.module encryption_get_cipher_algorithm()

Similar to the function above, this finds the "best" cipher which the server can support. Or, it can be manually set in the settings.php file by entering: $GLOBALS['encryption_cipher'] = 'NAME OF CIPHER';

3 calls to encryption_get_cipher_algorithm()
encryption_decrypt in modules/encryption/encryption.module
This will decrypt an encrypted string.
encryption_encrypt in modules/encryption/encryption.module
encryption_settings_form in modules/encryption/encryption.module


modules/encryption/encryption.module, line 281
This is the main module file for the encryption module.


function encryption_get_cipher_algorithm() {
  if (isset($GLOBALS ["encryption_cipher"])) {
    return $GLOBALS ["encryption_cipher"];

  $arr = openssl_get_cipher_methods();
  if (in_array('aes-256-cbc', $arr)) {
    return 'aes-256-cbc';
  if (in_array('aes-256-ctr', $arr)) {
    return 'aes-256-ctr';
  if (in_array('aes-256-cfb', $arr)) {
    return 'aes-256-cfb';

  if (in_array('aes-128-cbc', $arr)) {
    return 'aes-128-cbc';
  if (in_array('aes-128-ctr', $arr)) {
    return 'aes-128-ctr';
  if (in_array('aes-128-cfb', $arr)) {
    return 'aes-128-cfb';

  return FALSE;