ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4require_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
57 public function requiresSalt()
58 {
59 return false;
60 }
61}
comparePasswords($known_string, $user_string)
Compares two passwords.
isPasswordTooLong($password)
Checks if the password is too long.
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.string The encoded password}
requiresSalt()
{Returns whether or not the encoder requires a salt.boolean}
getName()
{Returns a unique name/id of the concrete password encoder.string}
__construct(array $config=array())
Class for user password exception handling in ILIAS.