24 $this->aead = new \fpoirotte\Pssht\Algorithms\AEAD\ChaCha20Poly1305($key);
29 return 'chacha20-poly1305@openssh.com';
54 $len = substr($data, 0, 4);
55 $plain = (string) substr($data, 4);
56 $iv = pack(
'N*', 0, $seqno);
57 return $this->aead->ae($iv, $plain, $len);
62 $iv = pack(
'N*', 0, $seqno);
63 if (strlen($data) === 4) {
64 return $this->aead->ad($iv, null, $data, null);
67 return $this->aead->ad(
69 (
string) substr($data, 4, -static::getSize()),
71 substr($data, -static::getSize())
static getName()
Return the name of the algorithm.
$aead
Underlying implementation for Authenticated Encryption with Additional Data.