[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 3 if (class_exists('ParagonIE_Sodium_Core_Poly1305', false)) { 4 return; 5 } 6 7 /** 8 * Class ParagonIE_Sodium_Core_Poly1305 9 */ 10 abstract class ParagonIE_Sodium_Core_Poly1305 extends ParagonIE_Sodium_Core_Util 11 { 12 const BLOCK_SIZE = 16; 13 14 /** 15 * @internal You should not use this directly from another application 16 * 17 * @param string $m 18 * @param string $key 19 * @return string 20 * @throws SodiumException 21 * @throws TypeError 22 */ 23 public static function onetimeauth($m, $key) 24 { 25 if (self::strlen($key) < 32) { 26 throw new InvalidArgumentException( 27 'Key must be 32 bytes long.' 28 ); 29 } 30 $state = new ParagonIE_Sodium_Core_Poly1305_State( 31 self::substr($key, 0, 32) 32 ); 33 return $state 34 ->update($m) 35 ->finish(); 36 } 37 38 /** 39 * @internal You should not use this directly from another application 40 * 41 * @param string $mac 42 * @param string $m 43 * @param string $key 44 * @return bool 45 * @throws SodiumException 46 * @throws TypeError 47 */ 48 public static function onetimeauth_verify($mac, $m, $key) 49 { 50 if (self::strlen($key) < 32) { 51 throw new InvalidArgumentException( 52 'Key must be 32 bytes long.' 53 ); 54 } 55 $state = new ParagonIE_Sodium_Core_Poly1305_State( 56 self::substr($key, 0, 32) 57 ); 58 $calc = $state 59 ->update($m) 60 ->finish(); 61 return self::verify_16($calc, $mac); 62 } 63 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Nov 23 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |