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

<?php

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

/**
 * Class ParagonIE_Sodium_Core_XChaCha20
 */
class ParagonIE_Sodium_Core_XChaCha20 extends ParagonIE_Sodium_Core_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, $nonce, $key)
    {
        if (self::strlen($nonce) !== 24) {
            throw new SodiumException('Nonce must be 24 bytes long');
        }
        return self::encryptBytes(
            new ParagonIE_Sodium_Core_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 int $len
     * @param string $nonce
     * @param string $key
     * @return string
     * @throws SodiumException
     * @throws TypeError
     */
    public static function ietfStream($len, $nonce, $key)
    {
        if (self::strlen($nonce) !== 24) {
            throw new SodiumException('Nonce must be 24 bytes long');
        }
        return self::encryptBytes(
            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
                self::hChaCha20(
                    self::substr($nonce, 0, 16),
                    $key
                ),
                "\x00\x00\x00\x00" . 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_Core_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 = '')
    {
        if (self::strlen($nonce) !== 24) {
            throw new SodiumException('Nonce must be 24 bytes long');
        }
        return self::encryptBytes(
            new ParagonIE_Sodium_Core_ChaCha20_IetfCtx(
                self::hChaCha20(self::substr($nonce, 0, 16), $key),
                "\x00\x00\x00\x00" . self::substr($nonce, 16, 8),
                $ic
            ),
            $message
        );
    }
}

Directory Contents

Dirs: 7 × Files: 18

Name Size Perms Modified Actions
AEGIS DIR
- drwxr-xr-x 2026-06-08 11:09:50
Edit Download
AES DIR
- drwxr-xr-x 2026-06-15 03:20:54
Edit Download
Base64 DIR
- drwxr-xr-x 2026-06-08 11:09:50
Edit Download
ChaCha20 DIR
- drwxr-xr-x 2026-06-15 03:20:58
Edit Download
- drwxr-xr-x 2026-06-15 03:21:04
Edit Download
Poly1305 DIR
- drwxr-xr-x 2026-06-15 03:21:06
Edit Download
- drwxr-xr-x 2026-06-08 11:09:50
Edit Download
3.58 KB lrw-r--r-- 2024-07-18 10:48:16
Edit Download
3.51 KB lrw-r--r-- 2024-07-18 10:48:16
Edit Download
15.51 KB lrw-r--r-- 2024-07-18 10:48:16
Edit Download
23.63 KB lrw-r--r-- 2022-03-24 13:20:08
Edit Download
12.59 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
140.27 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
18.05 KB lrw-r--r-- 2025-12-30 20:55:38
Edit Download
60.41 KB lrw-r--r-- 2026-07-26 21:29:32
Edit Download
4.04 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
3.59 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
1.54 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
21.37 KB lrw-r--r-- 2021-05-25 10:55:58
Edit Download
8.04 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download
8.04 KB lrw-r--r-- 2021-05-25 10:55:58
Edit Download
28.23 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
8.22 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
3.24 KB lrw-r--r-- 2025-10-06 12:48:40
Edit Download
1.34 KB lrw-r--r-- 2019-03-21 02:56:52
Edit Download

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