SodiumHandler
extends BaseHandler
in package
SodiumHandler uses libsodium in encryption.
Tags
Table of Contents
Properties
- $blockSize : int
- Block size for padding message.
- $key : string|null
- Starter key
Methods
- __construct() : mixed
- Constructor
- __get() : array<string|int, mixed>|bool|int|string|null
- __get() magic, providing readonly access to some of our properties
- __isset() : bool
- __isset() magic, providing checking for some of our properties
- decrypt() : string
- Decrypt - convert ciphertext into plaintext
- encrypt() : string
- Encrypt - convert plaintext into ciphertext
- parseParams() : void
- Parse the $params before doing assignment.
- substr() : string
- Byte-safe substr()
Properties
$blockSize
Block size for padding message.
protected
int
$blockSize
= 16
$key
Starter key
protected
string|null
$key
= ''
Null is used for buffer cleanup.
Methods
__construct()
Constructor
public
__construct([Encryption|null $config = null ]) : mixed
Parameters
- $config : Encryption|null = null
__get()
__get() magic, providing readonly access to some of our properties
public
__get(string $key) : array<string|int, mixed>|bool|int|string|null
Parameters
- $key : string
-
Property name
Return values
array<string|int, mixed>|bool|int|string|null__isset()
__isset() magic, providing checking for some of our properties
public
__isset(string $key) : bool
Parameters
- $key : string
-
Property name
Return values
booldecrypt()
Decrypt - convert ciphertext into plaintext
public
decrypt(mixed $data[, mixed $params = null ]) : string
Parameters
- $data : mixed
-
Encrypted data
- $params : mixed = null
-
Overridden parameters, specifically the key
Return values
stringencrypt()
Encrypt - convert plaintext into ciphertext
public
encrypt(mixed $data[, mixed $params = null ]) : string
Parameters
- $data : mixed
-
Input data
- $params : mixed = null
-
Overridden parameters, specifically the key
Return values
stringparseParams()
Parse the $params before doing assignment.
protected
parseParams(array<string|int, mixed>|string|null $params) : void
Parameters
- $params : array<string|int, mixed>|string|null
Tags
substr()
Byte-safe substr()
protected
static substr(string $str, int $start[, int $length = null ]) : string
Parameters
- $str : string
- $start : int
- $length : int = null