| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 17 | public function getBody() |
|
| 26 | { |
||
| 27 | 17 | if (null === $this->password) { |
|
| 28 | return [ |
||
| 29 | 4 | IProto::TUPLE => [], |
|
| 30 | 4 | IProto::USER_NAME => $this->username, |
|
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 34 | 13 | $hash1 = sha1($this->password, true); |
|
| 35 | 13 | $hash2 = sha1($hash1, true); |
|
| 36 | 13 | $scramble = sha1($this->salt.$hash2, true); |
|
| 37 | 13 | $scramble = self::strxor($hash1, $scramble); |
|
| 38 | |||
| 39 | return [ |
||
| 40 | 13 | IProto::TUPLE => ['chap-sha1', $scramble], |
|
| 41 | 13 | IProto::USER_NAME => $this->username, |
|
| 42 | ]; |
||
| 43 | } |
||
| 44 | |||
| 56 |