PHP 8.0.30
Preview: XChaCha20.php Size: 2.40 KB
/home/certprox/template.certproxywizard.com/wp-includes/sodium_compat/src/Core32/XChaCha20.php

<?php

if (class_exists('ParagonIE_Sodium_Core32_XChaCha20', false)) {
    return;
}

/**
 * Class ParagonIE_Sodium_Core32_XChaCha20
 */
class ParagonIE_Sodium_Core32_XChaCha20 extends ParagonIE_Sodium_Core32_HChaCha20
{
    /**
     * @internal You should not use this directly from another application
     *
     * @param int $len
     * @param string $nonce
     * @param string $key
     * @return string
     * @throws SodiumException
     * @throws TypeError
     */
    public static function stream($len = 64, $nonce = '', $key = '')
    {
        if (self::strlen($nonce) !== 24) {
            throw new SodiumException('Nonce must be 24 bytes long');
        }
        return self::encryptBytes(
            new ParagonIE_Sodium_Core32_ChaCha20_Ctx(
                self::hChaCha20(
                    self::substr($nonce, 0, 16),
                    $key
                ),
                self::substr($nonce, 16, 8)
            ),
            str_repeat("\x00", $len)
        );
    }

    /**
     * @internal You should not use this directly from another application
     *
     * @param string $message
     * @param string $nonce
     * @param string $key
     * @param string $ic
     * @return string
     * @throws SodiumException
     * @throws TypeError
     */
    public static function streamXorIc($message, $nonce = '', $key = '', $ic = '')
    {
        if (self::strlen($nonce) !== 24) {
            throw new SodiumException('Nonce must be 24 bytes long');
        }
        return self::encryptBytes(
            new ParagonIE_Sodium_Core32_ChaCha20_Ctx(
                self::hChaCha20(self::substr($nonce, 0, 16), $key),
                self::substr($nonce, 16, 8),
                $ic
            ),
            $message
        );
    }

    /**
     * @internal You should not use this directly from another application
     *
     * @param string $message
     * @param string $nonce
     * @param string $key
     * @param string $ic
     * @return string
     * @throws SodiumException
     * @throws TypeError
     */
    public static function ietfStreamXorIc($message, $nonce = '', $key = '', $ic = '')
    {
        return self::encryptBytes(
            new ParagonIE_Sodium_Core32_ChaCha20_IetfCtx(
                self::hChaCha20(self::substr($nonce, 0, 16), $key),
                "\x00\x00\x00\x00" . self::substr($nonce, 16, 8),
                $ic
            ),
            $message
        );
    }
}

Directory Contents

Dirs: 4 × Files: 16

Name Size Perms Modified Actions
ChaCha20 DIR
- drwxr-xr-x 2026-06-15 03:21:14
Edit Download
- drwxr-xr-x 2026-06-15 03:21:18
Edit Download
Poly1305 DIR
- drwxr-xr-x 2026-06-15 03:21:21
Edit Download
- drwxr-xr-x 2026-06-08 11:09:50
Edit Download
21.80 KB lrw-r--r-- 2021-05-25 10:55:58
Edit Download
14.17 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
129.86 KB lrw-r--r-- 2022-03-24 13:20:08
Edit Download
15.37 KB lrw-r--r-- 2022-09-13 21:13:14
Edit Download
50.13 KB lrw-r--r-- 2026-07-26 21:29:34
Edit Download
5.17 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
6.78 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
24.00 KB lrw-r--r-- 2022-03-24 13:20:08
Edit Download
30.44 KB lrw-r--r-- 2022-03-24 13:20:08
Edit Download
1.55 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
11.24 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
6.46 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
209 B lrw-r--r-- 2019-03-21 02:56:52
Edit Download
10.78 KB lrw-r--r-- 2019-12-09 14:42:04
Edit Download
2.40 KB lrw-r--r-- 2022-03-24 13:20:08
Edit Download
1.35 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).