Documentation

Cipher

An authenticated cipher behind Encryption. Implementations must detect a wrong key or a modified payload, so only AEAD algorithms qualify.

Table of Contents

decrypt()  : string
encrypt()  : string

Methods

decrypt()

public decrypt(string $key, string $payload) : string
Parameters
$key : string

32 raw bytes

$payload : string
Tags
throws
DecryptionException

When the key is wrong or the payload is malformed or modified

Return values
string —

encrypt()

public encrypt(string $key, string $plaintext) : string
Parameters
$key : string

32 raw bytes

$plaintext : string
Return values
string —

Raw bytes, including everything decrypt() needs besides the key

Search results