ParagonIE_Sodium_Core_SipHash::sipRound

Advertisement

Syntax Syntax

ParagonIE_Sodium_Core_SipHash::sipRound( int[] $v )

Parameters Parameters

$v

(int[]) (Required)

Return Return

(int[])

Source Source

File: wp-includes/sodium_compat/src/Core/SipHash.php

    public static function sipRound(array $v)
    {
        # v0 += v1;
        list($v[0], $v[1]) = self::add(
            array($v[0], $v[1]),
            array($v[2], $v[3])
        );

        #  v1=ROTL(v1,13);
        list($v[2], $v[3]) = self::rotl_64($v[2], $v[3], 13);

        #  v1 ^= v0;
        $v[2] ^= $v[0];
        $v[3] ^= $v[1];

        #  v0=ROTL(v0,32);
        list($v[0], $v[1]) = self::rotl_64((int) $v[0], (int) $v[1], 32);

        # v2 += v3;
        list($v[4], $v[5]) = self::add(
            array($v[4], $v[5]),
            array($v[6], $v[7])
        );

        # v3=ROTL(v3,16);
        list($v[6], $v[7]) = self::rotl_64($v[6], $v[7], 16);

        #  v3 ^= v2;
        $v[6] ^= $v[4];
        $v[7] ^= $v[5];

        # v0 += v3;
        list($v[0], $v[1]) = self::add(
            array((int) $v[0], (int) $v[1]),
            array((int) $v[6], (int) $v[7])
        );

        # v3=ROTL(v3,21);
        list($v[6], $v[7]) = self::rotl_64((int) $v[6], (int) $v[7], 21);

        # v3 ^= v0;
        $v[6] ^= $v[0];
        $v[7] ^= $v[1];

        # v2 += v1;
        list($v[4], $v[5]) = self::add(
            array((int) $v[4], (int) $v[5]),
            array((int) $v[2], (int) $v[3])
        );

        # v1=ROTL(v1,17);
        list($v[2], $v[3]) = self::rotl_64((int) $v[2], (int) $v[3], 17);

        #  v1 ^= v2;;
        $v[2] ^= $v[4];
        $v[3] ^= $v[5];

        # v2=ROTL(v2,32)
        list($v[4], $v[5]) = self::rotl_64((int) $v[4], (int) $v[5], 32);

        return $v;
    }

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.