[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 3 if (class_exists('ParagonIE_Sodium_Core_ChaCha20_IetfCtx', false)) { 4 return; 5 } 6 7 /** 8 * Class ParagonIE_Sodium_Core_ChaCha20_IetfCtx 9 */ 10 class ParagonIE_Sodium_Core_ChaCha20_IetfCtx extends ParagonIE_Sodium_Core_ChaCha20_Ctx 11 { 12 /** 13 * ParagonIE_Sodium_Core_ChaCha20_IetfCtx constructor. 14 * 15 * @internal You should not use this directly from another application 16 * 17 * @param string $key ChaCha20 key. 18 * @param string $iv Initialization Vector (a.k.a. nonce). 19 * @param string $counter The initial counter value. 20 * Defaults to 4 0x00 bytes. 21 * @throws InvalidArgumentException 22 * @throws TypeError 23 */ 24 public function __construct($key = '', $iv = '', $counter = '') 25 { 26 if (self::strlen($iv) !== 12) { 27 throw new InvalidArgumentException('ChaCha20 expects a 96-bit nonce in IETF mode.'); 28 } 29 parent::__construct($key, self::substr($iv, 0, 8), $counter); 30 31 if (!empty($counter)) { 32 $this->container[12] = self::load_4(self::substr($counter, 0, 4)); 33 } 34 $this->container[13] = self::load_4(self::substr($iv, 0, 4)); 35 $this->container[14] = self::load_4(self::substr($iv, 4, 4)); 36 $this->container[15] = self::load_4(self::substr($iv, 8, 4)); 37 } 38 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Oct 7 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |