‪TYPO3CMS  9.5
AbstractComposedSalt.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
25 {
31  abstract protected function ‪getItoa64(): string;
32 
41  public function ‪base64Encode(string $input, int $count): string
42  {
43  trigger_error('This method will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
44  ‪$output = '';
45  $i = 0;
46  $itoa64 = $this->‪getItoa64();
47  do {
48  $value = ord($input[$i++]);
49  ‪$output .= $itoa64[$value & 63];
50  if ($i < $count) {
51  $value |= ord($input[$i]) << 8;
52  }
53  ‪$output .= $itoa64[$value >> 6 & 63];
54  if ($i++ >= $count) {
55  break;
56  }
57  if ($i < $count) {
58  $value |= ord($input[$i]) << 16;
59  }
60  ‪$output .= $itoa64[$value >> 12 & 63];
61  if ($i++ >= $count) {
62  break;
63  }
64  ‪$output .= $itoa64[$value >> 18 & 63];
65  } while ($i < $count);
66  return ‪$output;
67  }
68 
77  protected function ‪getLengthBase64FromBytes(int $byteLength): int
78  {
79  trigger_error('This method will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
80  // Calculates bytes in bits in base64
81  return (int)ceil($byteLength * 8 / 6);
82  }
83 }
‪TYPO3\CMS\Core\Crypto\PasswordHashing
Definition: AbstractComposedSalt.php:3
‪TYPO3\CMS\Core\Crypto\PasswordHashing\AbstractComposedSalt
Definition: AbstractComposedSalt.php:25
‪TYPO3\CMS\Core\Crypto\PasswordHashing\AbstractComposedSalt\getLengthBase64FromBytes
‪int getLengthBase64FromBytes(int $byteLength)
Definition: AbstractComposedSalt.php:77
‪TYPO3\CMS\Core\Crypto\PasswordHashing\AbstractComposedSalt\getItoa64
‪string getItoa64()
‪$output
‪$output
Definition: annotationChecker.php:113
‪TYPO3\CMS\Core\Crypto\PasswordHashing\AbstractComposedSalt\base64Encode
‪string base64Encode(string $input, int $count)
Definition: AbstractComposedSalt.php:41