What is Drupal's default password encryption method?

后端 未结 5 1381
谎友^
谎友^ 2020-12-13 08:33

I am trying to figure out what is the security that Drupal 6/7 uses by default to store passwords. Is it MD5, AES, SHA? I have been unable to find anything.

5条回答
  •  时光说笑
    2020-12-13 09:31

    Drupal 8 and Drupal 7 use SHA512 by default with a salt. They run the hash through PHP's hash function numerous times to increase the computation cost of generating a password's final hash (a security technique called stretching).

    With Drupal 8, the implementation is object oriented. There is a PasswordInterface which defines a hash method. The default implementation of that interface is in the PhpassHashedPassword class. That class' hash method calls the crypt method passing in SHA512 as the hashing algorithm, a password, and a generated salt. The class' crypt method is nearly the same as Drupal 7's _password_crypt() method.

    With Drupal 7, the implementation is split into a couple global functions: user_hash_password() and _password_crypt().

    Drupal 6 uses MD5 without a salt. The relevant function is user_save().

提交回复
热议问题