X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/password/MWSaltedPassword.php diff --git a/includes/password/MWSaltedPassword.php b/includes/password/MWSaltedPassword.php new file mode 100644 index 00000000..733984cf --- /dev/null +++ b/includes/password/MWSaltedPassword.php @@ -0,0 +1,50 @@ +args ) == 0 ) { + $this->args[] = MWCryptRand::generateHex( 8 ); + } + + $this->hash = md5( $this->args[0] . '-' . md5( $plaintext ) ); + + if ( !is_string( $this->hash ) || strlen( $this->hash ) < 32 ) { + throw new PasswordError( 'Error when hashing password.' ); + } + } +}