Encryption
in package
Encryption class for encrypt/decrypt that works between programming languages.
Tags
Table of Contents
Properties
- $encryptMethod : string
Methods
- decrypt() : mixed
- Decrypt string.
- encrypt() : string
- Encrypt string.
- setCipherMethod() : mixed
- Set encryption method.
- encryptMethodLength() : int
- Get encrypt method length number (128, 192, 256).
Properties
$encryptMethod
protected
string
$encryptMethod
= 'AES-256-CBC'
Cipher method. Recommended AES-128-CBC, AES-192-CBC, AES-256-CBC
Tags
Methods
decrypt()
Decrypt string.
public
decrypt(string $encryptedString, string $key) : mixed
Parameters
- $encryptedString : string
-
The encrypted string that is base64 encode.
- $key : string
-
The key.
Tags
Return values
mixed —Return original string value. Return null for failure get salt, iv.
encrypt()
Encrypt string.
public
encrypt(string $string, string $key) : string
Parameters
- $string : string
-
The original string to be encrypt.
- $key : string
-
The key.
Tags
Return values
string —Return encrypted string.
setCipherMethod()
Set encryption method.
public
setCipherMethod(string $cipherMethod) : mixed
Parameters
- $cipherMethod : string
Tags
encryptMethodLength()
Get encrypt method length number (128, 192, 256).
protected
encryptMethodLength() : int