PasswordEncoder
in package
Password encoder for microsoft office applications.
Table of Contents
Constants
- ALGORITHM_HMAC = 'HMAC'
- ALGORITHM_MAC = 'MAC'
- ALGORITHM_MD2 = 'MD2'
- ALGORITHM_MD4 = 'MD4'
- ALGORITHM_MD5 = 'MD5'
- ALGORITHM_RIPEMD = 'RIPEMD'
- ALGORITHM_RIPEMD_160 = 'RIPEMD-160'
- ALGORITHM_SHA_1 = 'SHA-1'
- ALGORITHM_SHA_256 = 'SHA-256'
- ALGORITHM_SHA_384 = 'SHA-384'
- ALGORITHM_SHA_512 = 'SHA-512'
- ALL_ONE_BITS = (PHP_INT_SIZE > 4) ? 0xffffffff : -1
- HIGH_ORDER_BIT = (PHP_INT_SIZE > 4) ? 0x80000000 : PHP_INT_MIN
Properties
- $algorithmMapping : array<string|int, mixed>
- Mapping between algorithm name and algorithm ID.
- $encryptionMatrix : mixed
- $initialCodeArray : mixed
- $passwordMaxLength : mixed
Methods
- getAlgorithmId() : int
- Returns the algorithm ID.
- hashPassword() : string
- Create a hashed password that MS Word will be able to work with.
- buildCombinedKey() : int
- Build combined key from low-order word and high-order word.
- getAlgorithm() : string
- Get algorithm from self::$algorithmMapping.
- int32() : int
- Simulate behaviour of (signed) int32.
Constants
ALGORITHM_HMAC
public
mixed
ALGORITHM_HMAC
= 'HMAC'
ALGORITHM_MAC
public
mixed
ALGORITHM_MAC
= 'MAC'
ALGORITHM_MD2
public
mixed
ALGORITHM_MD2
= 'MD2'
ALGORITHM_MD4
public
mixed
ALGORITHM_MD4
= 'MD4'
ALGORITHM_MD5
public
mixed
ALGORITHM_MD5
= 'MD5'
ALGORITHM_RIPEMD
public
mixed
ALGORITHM_RIPEMD
= 'RIPEMD'
ALGORITHM_RIPEMD_160
public
mixed
ALGORITHM_RIPEMD_160
= 'RIPEMD-160'
ALGORITHM_SHA_1
public
mixed
ALGORITHM_SHA_1
= 'SHA-1'
ALGORITHM_SHA_256
public
mixed
ALGORITHM_SHA_256
= 'SHA-256'
ALGORITHM_SHA_384
public
mixed
ALGORITHM_SHA_384
= 'SHA-384'
ALGORITHM_SHA_512
public
mixed
ALGORITHM_SHA_512
= 'SHA-512'
ALL_ONE_BITS
private
mixed
ALL_ONE_BITS
= (PHP_INT_SIZE > 4) ? 0xffffffff : -1
HIGH_ORDER_BIT
private
mixed
HIGH_ORDER_BIT
= (PHP_INT_SIZE > 4) ? 0x80000000 : PHP_INT_MIN
Properties
$algorithmMapping
Mapping between algorithm name and algorithm ID.
private
static array<string|int, mixed>
$algorithmMapping
= [
self::ALGORITHM_MD2 => [1, 'md2'],
self::ALGORITHM_MD4 => [2, 'md4'],
self::ALGORITHM_MD5 => [3, 'md5'],
self::ALGORITHM_SHA_1 => [4, 'sha1'],
self::ALGORITHM_MAC => [5, ''],
// 'mac' -> not possible with hash()
self::ALGORITHM_RIPEMD => [6, 'ripemd'],
self::ALGORITHM_RIPEMD_160 => [7, 'ripemd160'],
self::ALGORITHM_HMAC => [9, ''],
//'hmac' -> not possible with hash()
self::ALGORITHM_SHA_256 => [12, 'sha256'],
self::ALGORITHM_SHA_384 => [13, 'sha384'],
self::ALGORITHM_SHA_512 => [14, 'sha512'],
]
Tags
$encryptionMatrix
private
static mixed
$encryptionMatrix
= [[0xaefc, 0x4dd9, 0x9bb2, 0x2745, 0x4e8a, 0x9d14, 0x2a09], [0x7b61, 0xf6c2, 0xfda5, 0xeb6b, 0xc6f7, 0x9dcf, 0x2bbf], [0x4563, 0x8ac6, 0x5ad, 0xb5a, 0x16b4, 0x2d68, 0x5ad0], [0x375, 0x6ea, 0xdd4, 0x1ba8, 0x3750, 0x6ea0, 0xdd40], [0xd849, 0xa0b3, 0x5147, 0xa28e, 0x553d, 0xaa7a, 0x44d5], [0x6f45, 0xde8a, 0xad35, 0x4a4b, 0x9496, 0x390d, 0x721a], [0xeb23, 0xc667, 0x9cef, 0x29ff, 0x53fe, 0xa7fc, 0x5fd9], [0x47d3, 0x8fa6, 0xf6d, 0x1eda, 0x3db4, 0x7b68, 0xf6d0], [0xb861, 0x60e3, 0xc1c6, 0x93ad, 0x377b, 0x6ef6, 0xddec], [0x45a0, 0x8b40, 0x6a1, 0xd42, 0x1a84, 0x3508, 0x6a10], [0xaa51, 0x4483, 0x8906, 0x22d, 0x45a, 0x8b4, 0x1168], [0x76b4, 0xed68, 0xcaf1, 0x85c3, 0x1ba7, 0x374e, 0x6e9c], [0x3730, 0x6e60, 0xdcc0, 0xa9a1, 0x4363, 0x86c6, 0x1dad], [0x3331, 0x6662, 0xccc4, 0x89a9, 0x373, 0x6e6, 0xdcc], [0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48c4]]
$initialCodeArray
private
static mixed
$initialCodeArray
= [0xe1f0, 0x1d0f, 0xcc9c, 0x84c0, 0x110c, 0xe10, 0xf1ce, 0x313e, 0x1872, 0xe139, 0xd40f, 0x84f9, 0x280c, 0xa96a, 0x4ec3]
$passwordMaxLength
private
static mixed
$passwordMaxLength
= 15
Methods
getAlgorithmId()
Returns the algorithm ID.
public
static getAlgorithmId(string $algorithmName) : int
Parameters
- $algorithmName : string
Return values
inthashPassword()
Create a hashed password that MS Word will be able to work with.
public
static hashPassword(string $password[, string $algorithmName = self::ALGORITHM_SHA_1 ][, string $salt = null ][, int $spinCount = 10000 ]) : string
Parameters
- $password : string
- $algorithmName : string = self::ALGORITHM_SHA_1
- $salt : string = null
- $spinCount : int = 10000
Tags
Return values
stringbuildCombinedKey()
Build combined key from low-order word and high-order word.
private
static buildCombinedKey(array<string|int, mixed> $byteChars) : int
Parameters
- $byteChars : array<string|int, mixed>
-
byte array representation of password
Return values
intgetAlgorithm()
Get algorithm from self::$algorithmMapping.
private
static getAlgorithm(string $algorithmName) : string
Parameters
- $algorithmName : string
Return values
stringint32()
Simulate behaviour of (signed) int32.
private
static int32(int $value) : int
Parameters
- $value : int