You are here

public static function ParagonIE_Sodium_Core_Poly1305::onetimeauth_verify in Automatic Updates 8

Same name and namespace in other branches
  1. 7 vendor/paragonie/sodium_compat/src/Core/Poly1305.php \ParagonIE_Sodium_Core_Poly1305::onetimeauth_verify()

@internal You should not use this directly from another application

Parameters

string $mac:

string $m:

string $key:

Return value

bool

Throws

SodiumException

TypeError

2 calls to ParagonIE_Sodium_Core_Poly1305::onetimeauth_verify()
ParagonIE_Sodium_Crypto::secretbox_open in vendor/paragonie/sodium_compat/src/Crypto.php
Decrypt a ciphertext generated via secretbox().
ParagonIE_Sodium_Crypto::secretbox_xchacha20poly1305_open in vendor/paragonie/sodium_compat/src/Crypto.php
Decrypt a ciphertext generated via secretbox_xchacha20poly1305().

File

vendor/paragonie/sodium_compat/src/Core/Poly1305.php, line 48

Class

ParagonIE_Sodium_Core_Poly1305
Class ParagonIE_Sodium_Core_Poly1305

Code

public static function onetimeauth_verify($mac, $m, $key) {
  if (self::strlen($key) < 32) {
    throw new InvalidArgumentException('Key must be 32 bytes long.');
  }
  $state = new ParagonIE_Sodium_Core_Poly1305_State(self::substr($key, 0, 32));
  $calc = $state
    ->update($m)
    ->finish();
  return self::verify_16($calc, $mac);
}