wppaste
WordPress

ParagonIE_Sodium_Core32_SipHash

Source
wp-includes/sodium_compat/src/Core32/SipHash.php:12
Class ParagonIE_SodiumCompat_Core32_SipHash

Description

Only uses 32-bit arithmetic, while the original SipHash used 64-bit integers

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).

Methods · 2

Source code

class ParagonIE_Sodium_Core32_SipHash extends ParagonIE_Sodium_Core32_Util{    /**     * @internal You should not use this directly from another application     *     * @param array<int, ParagonIE_Sodium_Core32_Int64> $v     * @return array<int, ParagonIE_Sodium_Core32_Int64>     */    public static function sipRound(array $v)    {        # v0 += v1;        $v[0] = $v[0]->addInt64($v[1]);         # v1 = ROTL(v1, 13);        $v[1] = $v[1]->rotateLeft(13);         #  v1 ^= v0;        $v[1] = $v[1]->xorInt64($v[0]);         #  v0=ROTL(v0,32);        $v[0] = $v[0]->rotateLeft(32);         # v2 += v3;        $v[2] = $v[2]->addInt64($v[3]);         # v3=ROTL(v3,16);        $v[3] = $v[3]->rotateLeft(16);         #  v3 ^= v2;        $v[3] = $v[3]->xorInt64($v[2]);         # v0 += v3;        $v[0] = $v[0]->addInt64($v[3]);         # v3=ROTL(v3,21);        $v[3] = $v[3]->rotateLeft(21);         # v3 ^= v0;        $v[3] = $v[3]->xorInt64($v[0]);         # v2 += v1;        $v[2] = $v[2]->addInt64($v[1]);         # v1=ROTL(v1,17);        $v[1] = $v[1]->rotateLeft(17);         #  v1 ^= v2;        $v[1] = $v[1]->xorInt64($v[2]);         # v2=ROTL(v2,32)        $v[2] = $v[2]->rotateLeft(32);         return $v;    }     /**     * @internal You should not use this directly from another application     *     * @param string $in     * @param string $key     * @return string     * @throws SodiumException     * @throws TypeError     */    public static function sipHash24($in, $key)    {        $inlen = self::strlen($in);         # /* "somepseudorandomlygeneratedbytes" */        # u64 v0 = 0x736f6d6570736575ULL;        # u64 v1 = 0x646f72616e646f6dULL;        # u64 v2 = 0x6c7967656e657261ULL;        # u64 v3 = 0x7465646279746573ULL;        $v = array(            new ParagonIE_Sodium_Core32_Int64(                array(0x736f, 0x6d65, 0x7073, 0x6575)            ),            new ParagonIE_Sodium_Core32_Int64(                array(0x646f, 0x7261, 0x6e64, 0x6f6d)            ),

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/Core32/SipHash.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.