ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Shared_PasswordHasher Class Reference
+ Collaboration diagram for PHPExcel_Shared_PasswordHasher:

Static Public Member Functions

static hashPassword ($pPassword= '')
 Create a password hash from a given string.

Detailed Description

Definition at line 36 of file PasswordHasher.php.

Member Function Documentation

static PHPExcel_Shared_PasswordHasher::hashPassword (   $pPassword = '')
static

Create a password hash from a given string.

This method is based on the algorithm provided by Daniel Rentz of OpenOffice and the PEAR package Spreadsheet_Excel_Writer by Xavier Noguer xnogu.nosp@m.er@r.nosp@m.ezebr.nosp@m.a.co.nosp@m.m.

Parameters
string$pPasswordPassword to hash
Returns
string Hashed password

Definition at line 48 of file PasswordHasher.php.

Referenced by PHPExcel_Worksheet\protectCells(), PHPExcel_Worksheet_Protection\setPassword(), PHPExcel_DocumentSecurity\setRevisionsPassword(), and PHPExcel_DocumentSecurity\setWorkbookPassword().

{
$password = 0x0000;
$i = 1; // char position
// split the plain text password in its component characters
$chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY);
foreach ($chars as $char) {
$value = ord($char) << $i; // shifted ASCII value
$rotated_bits = $value >> 15; // rotated bits beyond bit 15
$value &= 0x7fff; // first 15 bits
$password ^= ($value | $rotated_bits);
++$i;
}
$password ^= strlen($pPassword);
$password ^= 0xCE4B;
return(strtoupper(dechex($password)));
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: