Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct ($hash='sha256') | |
setKey ($key=false) | |
setNonce ($nonce=false) | |
getHash () | |
setHash ($hash) | |
hash ($text) | |
getLength () | |
getLengthInBytes () | |
getBlockLength () | |
getBlockLengthInBytes () | |
__toString () | |
Champs de données | |
const | PADDING_KECCAK = 1 |
const | PADDING_SHA3 = 2 |
const | PADDING_SHAKE = 3 |
Fonctions membres privées | |
computeKey () | |
kdf ($index, $numbytes) | |
pdf () | |
uhash ($m, $taglen) | |
Fonctions membres privées statiques | |
static | L1Hash ($k, $m) |
static | nh ($k, $m, $length) |
static | L2Hash ($k, $m) |
static | poly ($wordbits, $maxwordrange, $k, $m) |
static | L3Hash ($k1, $k2, $m) |
static | sha3_pad ($padLength, $padType) |
static | sha3_32 ($p, $c, $r, $d, $padType) |
static | processSHA3Block32 (&$s) |
static | rotateLeft32 ($x, $shift) |
static | sha3_64 ($p, $c, $r, $d, $padType) |
static | processSHA3Block64 (&$s) |
static | rotateLeft64 ($x, $shift) |
static | sha512 ($m, $hash) |
Attributs privés | |
$paddingType = 0 | |
$hashParam | |
$length | |
$algo | |
$key = false | |
$nonce = false | |
$parameters = [] | |
$computedKey = false | |
$opad | |
$ipad | |
$recomputeAESKey | |
$c | |
$pad | |
Attributs privés statiques | |
static | $factory36 |
static | $factory64 |
static | $factory128 |
static | $offset64 |
static | $offset128 |
static | $marker64 |
static | $marker128 |
static | $maxwordrange64 |
static | $maxwordrange128 |
__construct | ( | $hash = 'sha256' | ) |
__toString | ( | ) |
__toString() magic method
Références Hash\getHash().
|
private |
Pre-compute the key used by the HMAC
Quoting http://tools.ietf.org/html/rfc2104#section-2, "Applications that use keys longer than B bytes will first hash the key using H and then use the resultant L byte string as the actual key to HMAC."
As documented in https://www.reddit.com/r/PHP/comments/9nct2l/symfonypolyfill_hash_pbkdf2_correct_fix_for/ when doing an HMAC multiple times it's faster to compute the hash once instead of computing it during every call
private
Références Hash\$key, Hash\getBlockLengthInBytes(), et Hash\hash().
Référencé par Hash\setHash(), et Hash\setKey().
getBlockLength | ( | ) |
Returns the block length (in bits)
public
getBlockLengthInBytes | ( | ) |
getHash | ( | ) |
Gets the hash function.
As set by the constructor or by the setHash() method.
public
Références Hash\$hashParam.
Référencé par Hash\__toString().
getLength | ( | ) |
Returns the hash length (in bits)
public
getLengthInBytes | ( | ) |
hash | ( | $text | ) |
Compute the Hash / HMAC / UMAC.
public
string | $text |
Références Hash\$algo, $b, Hash\$key, Hash\$maxwordrange128, Hash\$maxwordrange64, $output, Hash\$pad, $temp, $text, Hash\pdf(), et Hash\uhash().
Référencé par Hash\computeKey().
|
private |
KDF: Key-Derivation Function
The key-derivation function generates pseudorandom bits used to key the hash functions.
int | $index | a non-negative integer less than 2^64 |
int | $numbytes | a non-negative integer less than 2^64 |
Référencé par Hash\pdf(), et Hash\uhash().
|
staticprivate |
L1-HASH Algorithm
The first-layer hash breaks the message into 1024-byte chunks and hashes each with a function called NH. Concatenating the results forms a string, which is up to 128 times shorter than the original.
string | $k | string of length 1024 bytes. |
string | $m | string of length less than 2^67 bits. |
Références $i, Hash\$length, et Hash\$pad.
|
staticprivate |
L2-HASH: Second-Layer Hash
The second-layer rehashes the L1-HASH output using a polynomial hash called POLY. If the L1-HASH output is long, then POLY is called once on a prefix of the L1-HASH output and called using different settings on the remainder. (This two-step hashing of the L1-HASH output is needed only if the message length is greater than 16 megabytes.) Careful implementation of POLY is necessary to avoid a possible timing attack (see Section 6.6 for more information).
string | $k | string of length 24 bytes. |
string | $m | string of length less than 2^64 bytes. |
Références Hash\$length, et Hash\$pad.
|
staticprivate |
L3-HASH: Third-Layer Hash
The output from L2-HASH is 16 bytes long. This final hash function hashes the 16-byte string to a fixed length of 4 bytes.
string | $k1 | string of length 64 bytes. |
string | $k2 | string of length 4 bytes. |
string | $m | string of length 16 bytes. |
Références $i.
|
staticprivate |
NH Algorithm
string | $k | string of length 1024 bytes. |
string | $m | string with length divisible by 32 bytes. |
Références $i, Hash\$length, et $temp.
|
private |
PDF Algorithm
Références Hash\$c, Hash\$key, $last, Hash\$length, Hash\$nonce, et Hash\kdf().
Référencé par Hash\hash().
|
staticprivate |
POLY Algorithm
int | $wordbits | the integer 64 or 128. |
BigInteger | $maxwordrange | positive integer less than 2^wordbits. |
BigInteger | $k | integer in the range 0 ... prime(wordbits) - 1. |
string | $m | string with length divisible by (wordbits / 8) bytes. |
Références Joomla\Database\Query\$offset.
|
staticprivate |
|
staticprivate |
|
staticprivate |
Rotate 32-bit int
private
array | $x | |
int | $shift |
|
staticprivate |
Rotate 64-bit int
private
int | $x | |
int | $shift |
setHash | ( | $hash | ) |
Sets the hash function.
public
string | $hash |
Références $b, $hash, $i, Hash\$length, Hash\$paddingType, et Hash\computeKey().
Référencé par Hash\__construct().
setKey | ( | $key = false | ) |
Sets the key for HMACs
Keys can be of any length.
public
string | $key |
Références Hash\$key, et Hash\computeKey().
setNonce | ( | $nonce = false | ) |
Sets the nonce for UMACs
Keys can be of any length.
public
string | $nonce |
Références Hash\$nonce.
|
staticprivate |
Pure-PHP 32-bit implementation of SHA3
Whereas BigInteger.php's 32-bit engine works on PHP 64-bit this 32-bit implementation of SHA3 will not work on PHP 64-bit. This is because this implementation employees bitwise NOTs and bitwise left shifts. And the round constants only work on 32-bit PHP. eg. dechex(-2147483648) returns 80000000 on 32-bit PHP and FFFFFFFF80000000 on 64-bit PHP. Sure, we could do bitwise ANDs but that would slow things down.
SHA512 requires BigInteger to simulate 64-bit unsigned integers because SHA2 employees addition whereas SHA3 just employees bitwise operators. PHP64 only supports signed 64-bit integers, which complicates addition, whereas that limitation isn't an issue for SHA3.
In https://ws680.nist.gov/publication/get_pdf.cfm?pub_id=919061#page=16 KECCAK[C] is defined as "the KECCAK instance with KECCAK-f[1600] as the underlying permutation and capacity c". This is relevant because, altho the KECCAK standard defines a mode (KECCAK-f[800]) designed for 32-bit machines that mode is incompatible with SHA3
private
string | $p | |
int | $c | |
int | $r | |
int | $d | |
int | $padType |
|
staticprivate |
|
staticprivate |
Pads SHA3 based on the mode
private
int | $padLength | |
int | $padType |
Références $temp.
|
staticprivate |
Pure-PHP implementation of SHA512
private
string | $m | |
array | $hash |
Références $b, Hash\$c, $g, $hash, $i, Hash\$length, $temp, et Strings\shift().
|
private |
UHASH Algorithm
string | $m | string of length less than 2^67 bits. |
int | $taglen | the integer 4, 8, 12 or 16. |
Références $b, Hash\$c, $i, et Hash\kdf().
Référencé par Hash\hash().
|
private |
Référencé par Hash\hash().
|
private |
Référencé par Hash\pdf(), Hash\sha512(), et Hash\uhash().
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
Référencé par Hash\getHash().
|
private |
|
private |
Référencé par Hash\computeKey(), Hash\hash(), Hash\pdf(), et Hash\setKey().
|
private |
Référencé par Hash\getLengthInBytes(), Hash\L1Hash(), Hash\L2Hash(), Hash\nh(), Hash\pdf(), Hash\setHash(), et Hash\sha512().
|
staticprivate |
|
staticprivate |
|
staticprivate |
Référencé par Hash\hash().
|
staticprivate |
Référencé par Hash\hash().
|
private |
Référencé par Hash\pdf(), et Hash\setNonce().
|
staticprivate |
|
staticprivate |
|
private |
|
private |
Référencé par Hash\hash(), Hash\L1Hash(), et Hash\L2Hash().
|
private |
Référencé par Hash\setHash().
|
private |
|
private |
const PADDING_KECCAK = 1 |
Padding Types
private
const PADDING_SHA3 = 2 |
Padding Types
private
const PADDING_SHAKE = 3 |
Padding Types
private