class Encryption extends BaseEncryption

Class Encryption. Contains logic for hashing user's password

Constants

METHOD

HASH_ALGO

Hash algorithm

Properties

static protected bool|string $key from BaseEncryption

Methods

__construct()

BaseEncryption constructor.

static string
encrypt(string $message, string $key = null, boolean $encode = false)

Encrypts then MACs a message

static string
decrypt(string $message, mixed|null $key = null, bool $encoded = false)

No description

static array
splitKeys(string $masterKey)

Splits a key into two separate keys; one for encryption and the other for authenticaiton

static boolean
hashEquals(string $a, string $b)

Compare two strings without leaking timing information

Details

in BaseEncryption at line 31
__construct()

BaseEncryption constructor.

at line 31
static string encrypt(string $message, string $key = null, boolean $encode = false)

Encrypts then MACs a message

Parameters

string $message
  • plaintext message
string $key
  • encryption key (raw binary expected)
boolean $encode
  • set to TRUE to return a base64-encoded

Return Value

string (raw binary)

at line 58
static string decrypt(string $message, mixed|null $key = null, bool $encoded = false)

Parameters

string $message
mixed|null $key
bool $encoded

Return Value

string

Exceptions

Exception

at line 99
static protected array splitKeys(string $masterKey)

Splits a key into two separate keys; one for encryption and the other for authenticaiton

Parameters

string $masterKey (raw binary)

Return Value

array (two raw binary strings)

at line 118
static protected boolean hashEquals(string $a, string $b)

Compare two strings without leaking timing information

Parameters

string $a
string $b

Return Value

boolean