public static function ParagonIE_Sodium_Core32_HChaCha20::hChaCha20 in Automatic Updates 8
Same name and namespace in other branches
- 7 vendor/paragonie/sodium_compat/src/Core32/HChaCha20.php \ParagonIE_Sodium_Core32_HChaCha20::hChaCha20()
Parameters
string $in:
string $key:
string|null $c:
Return value
string
Throws
SodiumException
TypeError
7 calls to ParagonIE_Sodium_Core32_HChaCha20::hChaCha20()
- ParagonIE_Sodium_Core32_XChaCha20::stream in vendor/
paragonie/ sodium_compat/ src/ Core32/ XChaCha20.php - @internal You should not use this directly from another application
- ParagonIE_Sodium_Core32_XChaCha20::streamXorIc in vendor/
paragonie/ sodium_compat/ src/ Core32/ XChaCha20.php - @internal You should not use this directly from another application
- ParagonIE_Sodium_Crypto32::aead_xchacha20poly1305_ietf_decrypt in vendor/
paragonie/ sodium_compat/ src/ Crypto32.php - AEAD Decryption with ChaCha20-Poly1305, IETF mode (96-bit nonce)
- ParagonIE_Sodium_Crypto32::aead_xchacha20poly1305_ietf_encrypt in vendor/
paragonie/ sodium_compat/ src/ Crypto32.php - AEAD Encryption with ChaCha20-Poly1305, IETF mode (96-bit nonce)
- ParagonIE_Sodium_Crypto32::secretbox_xchacha20poly1305 in vendor/
paragonie/ sodium_compat/ src/ Crypto32.php - XChaCha20-Poly1305 authenticated symmetric-key encryption.
File
- vendor/
paragonie/ sodium_compat/ src/ Core32/ HChaCha20.php, line 20
Class
- ParagonIE_Sodium_Core32_HChaCha20
- Class ParagonIE_Sodium_Core_HChaCha20
Code
public static function hChaCha20($in = '', $key = '', $c = null) {
$ctx = array();
if ($c === null) {
$ctx[0] = new ParagonIE_Sodium_Core32_Int32(array(
0x6170,
0x7865,
));
$ctx[1] = new ParagonIE_Sodium_Core32_Int32(array(
0x3320,
0x646e,
));
$ctx[2] = new ParagonIE_Sodium_Core32_Int32(array(
0x7962,
0x2d32,
));
$ctx[3] = new ParagonIE_Sodium_Core32_Int32(array(
0x6b20,
0x6574,
));
}
else {
$ctx[0] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($c, 0, 4));
$ctx[1] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($c, 4, 4));
$ctx[2] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($c, 8, 4));
$ctx[3] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($c, 12, 4));
}
$ctx[4] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 0, 4));
$ctx[5] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 4, 4));
$ctx[6] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 8, 4));
$ctx[7] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 12, 4));
$ctx[8] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 16, 4));
$ctx[9] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 20, 4));
$ctx[10] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 24, 4));
$ctx[11] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($key, 28, 4));
$ctx[12] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($in, 0, 4));
$ctx[13] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($in, 4, 4));
$ctx[14] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($in, 8, 4));
$ctx[15] = ParagonIE_Sodium_Core32_Int32::fromReverseString(self::substr($in, 12, 4));
return self::hChaCha20Bytes($ctx);
}