wppaste
WordPress

ParagonIE_Sodium_Core_AEGIS_State128L

Source
wp-includes/sodium_compat/src/Core/AEGIS/State128L.php:14

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 · 1

$statearray<int,protected

Methods · 10

Source code

class ParagonIE_Sodium_Core_AEGIS_State128L{    /** @var array<int, string> $state */    protected $state;    public function __construct()    {        $this->state = array_fill(0, 8, '');    }     /**     * @internal Only use this for unit tests!     * @return string[]     */    public function getState()    {        return array_values($this->state);    }     /**     * @param array $input     * @return self     * @throws SodiumException     *     * @internal Only for unit tests     */    public static function initForUnitTests(array $input)    {        if (count($input) < 8) {            throw new SodiumException('invalid input');        }        $state = new self();        for ($i = 0; $i < 8; ++$i) {            $state->state[$i] = $input[$i];        }        return $state;    }     /**     * @param string $key     * @param string $nonce     * @return self     */    public static function init($key, $nonce)    {        $state = new self();         // S0 = key ^ nonce        $state->state[0] = $key ^ $nonce;        // S1 = C1        $state->state[1] = SODIUM_COMPAT_AEGIS_C1;        // S2 = C0        $state->state[2] = SODIUM_COMPAT_AEGIS_C0;        // S3 = C1        $state->state[3] = SODIUM_COMPAT_AEGIS_C1;        // S4 = key ^ nonce        $state->state[4] = $key ^ $nonce;        // S5 = key ^ C0        $state->state[5] = $key ^ SODIUM_COMPAT_AEGIS_C0;        // S6 = key ^ C1        $state->state[6] = $key ^ SODIUM_COMPAT_AEGIS_C1;        // S7 = key ^ C0        $state->state[7] = $key ^ SODIUM_COMPAT_AEGIS_C0;         // Repeat(10, Update(nonce, key))        for ($i = 0; $i < 10; ++$i) {            $state->update($nonce, $key);        }        return $state;    }     /**     * @param string $ai     * @return self     */    public function absorb($ai)    {        if (ParagonIE_Sodium_Core_Util::strlen($ai) !== 32) {            throw new SodiumException('Input must be two AES blocks in size');        }        $t0 = ParagonIE_Sodium_Core_Util::substr($ai, 0, 16);

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/AEGIS/State128L.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.