WordPress at Your Fingertips
function is not described

ParagonIE_Sodium_Core_Salsa20::salsa20() public WP 1.0

{} It's a method of the class: ParagonIE_Sodium_Core_Salsa20{}

No Hooks.

Return

String.

Usage

$result = ParagonIE_Sodium_Core_Salsa20::salsa20( $len, $nonce, $key );
$len(int) (required)
-
$nonce(string) (required)
-
$key(string) (required)
-

Code of ParagonIE_Sodium_Core_Salsa20::salsa20() WP 5.8.2

public static function salsa20($len, $nonce, $key)
{
    if (self::strlen($key) !== 32) {
        throw new RangeException('Key must be 32 bytes long');
    }
    $kcopy = '' . $key;
    $in = self::substr($nonce, 0, 8) . str_repeat("\0", 8);
    $c = '';
    while ($len >= 64) {
        $c .= self::core_salsa20($in, $kcopy, null);
        $u = 1;
        // Internal counter.
        for ($i = 8; $i < 16; ++$i) {
            $u += self::chrToInt($in[$i]);
            $in[$i] = self::intToChr($u & 0xff);
            $u >>= 8;
        }
        $len -= 64;
    }
    if ($len > 0) {
        $c .= self::substr(
            self::core_salsa20($in, $kcopy, null),
            0,
            $len
        );
    }
    try {
        ParagonIE_Sodium_Compat::memzero($kcopy);
    } catch (SodiumException $ex) {
        $kcopy = null;
    }
    return $c;
}