Manual:$wgPasswordDefault/zh
Appearance
| 认证: $wgPasswordDefault | |
|---|---|
| 當用雜湊演算打散密碼時的預設密碼類型。 |
|
| 引进版本: | 1.24.0(Gerrit change 77645; git #95a8974c) |
| 移除版本: | 仍在使用 |
| 允许的值: | (字符串) |
| 默认值: | 'pbkdf2' |
| 其他设置: 按首字母排序 | 按功能排序 | |
詳情
當用雜湊演算打散使用者密碼時的預設密碼類型。 The choices are:[1]
| $wgPasswordDefault | Algorithm | Class | Strength | Notes |
|---|---|---|---|---|
| A | MD5 | MWOldPassword | Insecure by modern standards | |
| B | MD5 | MWSaltedPassword | Insecure by modern standards | It involves running MD5 on the password, and then running MD5 on the salt concatenated with the first hash. |
| pbkdf2-legacyA | PBKDF2 | LayeredParameterizedPassword | ||
| pbkdf2-legacyB | PBKDF2 | LayeredParameterizedPassword | ||
| bcrypt | Bcrypt | BcryptPassword | Moderately secure | |
| pbkdf2 | PBKDF2 | Pbkdf2PasswordUsingOpenSSL | Moderately secure | Default for new MediaWiki installations as of 2026. |
| argon2 | Argon2 | Argon2Password | Most secure of currently supported options | Used by Wikimedia websites as of 2026.[2] |
After changing this setting, users will have their password updated to the new format on next login.
改變預設值
- 檢查
../includes目錄中的 "DefaultSettings.php" 檔,以了解可用和目前的密碼加密類型。 - 如果您想更改加密方式,請將變數
$wgPasswordDefault添加到“LocalSettings.php”文件中,例如:恢復到舊的 MD5 演算法:$wgPasswordDefault = 'B';
- 為了讓密碼以新格式保存,每個用戶至少必須進行一次登錄。 這樣就將資料庫中的密碼更新到新指定的格式了。
或者,您可以使用wrapOldPasswords.php腳本來轉換所有密碼的雜湊算法,而無需等待用戶登錄。 請注意,此腳本僅適用於pbkdf2-legacyA,pbkdf2-legacyB。 - 檢查 MySQL 資料庫是否已將新格式應用於各欄位。
Select user_password from wikidbname.user where user_password like ':B:%';