wppaste
WordPress

ParagonIE_Sodium_Core_AES_KeySchedule

Source
wp-includes/sodium_compat/src/Core/AES/KeySchedule.php:10

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 3

$skeyarray<int,protected
$expandedboolprotected
$numRoundsintprivate

Methods · 5

Source code

class ParagonIE_Sodium_Core_AES_KeySchedule{    /** @var array<int, int> $skey -- has size 120 */    protected $skey;     /** @var bool $expanded */    protected $expanded = false;     /** @var int $numRounds */    private $numRounds;     /**     * @param array $skey     * @param int $numRounds     */    public function __construct(array $skey, $numRounds = 10)    {        $this->skey = $skey;        $this->numRounds = $numRounds;    }     /**     * Get a value at an arbitrary index. Mostly used for unit testing.     *     * @param int $i     * @return int     */    public function get($i)    {        return $this->skey[$i];    }     /**     * @return int     */    public function getNumRounds()    {        return $this->numRounds;    }     /**     * @param int $offset     * @return ParagonIE_Sodium_Core_AES_Block     */    public function getRoundKey($offset)    {        return ParagonIE_Sodium_Core_AES_Block::fromArray(            array_slice($this->skey, $offset, 8)        );    }     /**     * Return an expanded key schedule     *     * @return ParagonIE_Sodium_Core_AES_Expanded     */    public function expand()    {        $exp = new ParagonIE_Sodium_Core_AES_Expanded(            array_fill(0, 120, 0),            $this->numRounds        );        $n = ($exp->numRounds + 1) << 2;        for ($u = 0, $v = 0; $u < $n; ++$u, $v += 2) {            $x = $y = $this->skey[$u];            $x &= 0x55555555;            $exp->skey[$v] = ($x | ($x << 1)) & ParagonIE_Sodium_Core_Util::U32_MAX;            $y &= 0xAAAAAAAA;            $exp->skey[$v + 1] = ($y | ($y >> 1)) & ParagonIE_Sodium_Core_Util::U32_MAX;        }        return $exp;    }}

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/sodium_compat/src/Core/AES/KeySchedule.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.