You are here

public static function ParagonIE_Sodium_Core_Poly1305::onetimeauth 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()

@internal You should not use this directly from another application

Parameters

string $m:

string $key:

Return value

string

Throws

SodiumException

TypeError

File

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

Class

ParagonIE_Sodium_Core_Poly1305
Class ParagonIE_Sodium_Core_Poly1305

Code

public static function onetimeauth($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));
  return $state
    ->update($m)
    ->finish();
}