You are here

function _acquia_agent_hash_password_crypt in Acquia Connector 7.3

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent.pages.inc \_acquia_agent_hash_password_crypt()
  2. 7.2 acquia_agent/acquia_agent.pages.inc \_acquia_agent_hash_password_crypt()

Hash password according to Drupal's password_crypt and settings from remote.

1 call to _acquia_agent_hash_password_crypt()
acquia_agent_automatic_setup_form_validate in acquia_agent/acquia_agent.pages.inc
Needs comment.

File

acquia_agent/acquia_agent.pages.inc, line 11
Acquia Agent configuration page.

Code

function _acquia_agent_hash_password_crypt($algorithm, $pass, $setting, $extra_md5 = FALSE) {

  // Server may state that password needs to be hashed with MD5 first.
  if ($extra_md5) {
    $pass = md5($pass);
  }

  // Include core's password.inc because it has _password_crypt().
  require_once DRUPAL_ROOT . '/includes/password.inc';
  $hash = _password_crypt($algorithm, $pass, $setting);

  // Match the hash stored on the server which has prefix character 'U' if
  // password was first hashed with MD5.
  if ($extra_md5) {
    $hash = 'U' . $hash;
  }
  return $hash;
}