ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMd5PasswordEncoder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
32 public function encodePassword(string $raw, string $salt): string
33 {
34 if ($this->isPasswordTooLong($raw)) {
35 throw new ilPasswordException('Invalid password.');
36 }
37
38 return md5($raw);
39 }
40
41 public function isPasswordValid(string $encoded, string $raw, string $salt): bool
42 {
43 return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt));
44 }
45
46 public function getName(): string
47 {
48 return 'md5';
49 }
50}
comparePasswords(string $knownString, string $userString)
Compares two passwords.
encodePassword(string $raw, string $salt)
Encodes the raw password.
getName()
Returns a unique name/id of the concrete password encoder.
isPasswordValid(string $encoded, string $raw, string $salt)
Checks a raw password against an encoded password.
Class for user password exception handling in ILIAS.