ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMd5PasswordEncoder.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Password/classes/class.ilBasePasswordEncoder.php';
5 
15 {
19  public function __construct(array $config = array())
20  {
21  }
22 
27  public function encodePassword($raw, $salt)
28  {
29  if ($this->isPasswordTooLong($raw)) {
30  require_once 'Services/Password/exceptions/class.ilPasswordException.php';
31  throw new ilPasswordException('Invalid password.');
32  }
33 
34  return md5($raw);
35  }
36 
40  public function isPasswordValid($encoded, $raw, $salt)
41  {
42  return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
43  }
44 
48  public function getName()
49  {
50  return 'md5';
51  }
52 }
comparePasswords($known_string, $user_string)
Compares two passwords.
$config
Definition: bootstrap.php:15
__construct(array $config=array())
Class for user password exception handling in ILIAS.
isPasswordValid($encoded, $raw, $salt)
{Checks a raw password against an encoded password.The raw password has to be injected into the encod...
encodePassword($raw, $salt)
{Encodes the raw password.The password to encode The salt string The encoded password} ...
getName()
{Returns a unique name/id of the concrete password encoder.string}
isPasswordTooLong($password)
Checks if the password is too long.