ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
31  require_once 'Services/Password/exceptions/class.ilPasswordException.php';
32  throw new ilPasswordException('Invalid password.');
33  }
34 
35  return md5($raw);
36  }
37 
41  public function isPasswordValid($encoded, $raw, $salt)
42  {
43  return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
44  }
45 
49  public function getName()
50  {
51  return 'md5';
52  }
53 }
comparePasswords($known_string, $user_string)
Compares two passwords.
__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}
Create styles array
The data for the language used.
isPasswordTooLong($password)
Checks if the password is too long.