PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.1
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Shared / PasswordHasher.php

PasswordHasher.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.7.1, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php

38 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Shared;
4
5 class PasswordHasher
6 {
7 /**
8 * Create a password hash from a given string.
9 *
10 * This method is based on the algorithm provided by
11 * Daniel Rentz of OpenOffice and the PEAR package
12 * Spreadsheet_Excel_Writer by Xavier Noguer <xnoguer@rezebra.com>.
13 *
14 * @param string $pPassword Password to hash
15 *
16 * @return string Hashed password
17 */
18 public static function hashPassword($pPassword)
19 {
20 $password = 0x0000;
21 $charPos = 1; // char position
22
23 // split the plain text password in its component characters
24 $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY);
25 foreach ($chars as $char) {
26 $value = ord($char) << $charPos++; // shifted ASCII value
27 $rotated_bits = $value >> 15; // rotated bits beyond bit 15
28 $value &= 0x7fff; // first 15 bits
29 $password ^= ($value | $rotated_bits);
30 }
31
32 $password ^= strlen($pPassword);
33 $password ^= 0xCE4B;
34
35 return strtoupper(dechex($password));
36 }
37 }
38