Cipher
Table of Contents
Methods
- __construct() : mixed
- Cipher constructor. Aes-256-ctr and sha256 are the best currently known methods.
- decrypt() : string
- Decrypts the data by key (symmetric cipher).
- encrypt() : string
- Encrypts the data by key (symmetric cipher).
Methods
__construct()
Cipher constructor. Aes-256-ctr and sha256 are the best currently known methods.
public
__construct([string $cipherAlgorithm = 'aes-256-ctr' ][, string $hashAlgorithm = 'sha256' ][, bool $calculateHash = true ]) : mixed
Parameters
- $cipherAlgorithm : string = 'aes-256-ctr'
- $hashAlgorithm : string = 'sha256'
- $calculateHash : bool = true
Tags
decrypt()
Decrypts the data by key (symmetric cipher).
public
decrypt(string $data, string $key) : string
Parameters
- $data : string
-
Binary data
- $key : string
Tags
Return values
stringencrypt()
Encrypts the data by key (symmetric cipher).
public
encrypt(string $data, string $key) : string
Parameters
- $data : string
- $key : string
Tags
Return values
string —Binary data.