| Methods | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
public
static
|
plaintext(string $string, string $key): string|false
Convert ciphertext to plaintext
Convert ciphertext to plaintext Parameters
Returnsdecrypted text Overriden by |
# | ||||||||||
public
static
|
check_hmac(string $crypt_string, string $hmac, string $salt, string $key, integer $rounds): boolean
Check hmac signature
Check hmac signature Parameters
|
# | ||||||||||
public
static
|
ciphertext(string $string, string $key): string
Convert plaintext into ciphertext
Convert plaintext into ciphertext Parameters
Returnsencrypted text Overriden by |
# | ||||||||||
public
static
|
generate_salt(): string
Generate a strong random salt (hopefully)
Generate a strong random salt (hopefully) |
# | ||||||||||
public
static
|
hash_compare(string $a, string $b): bool
Compare password hashes with hash_equals is available, otherwise use
timing attack safe comparison
Compare password hashes with hash_equals is available, otherwise use timing attack safe comparison Parameters
|
# | ||||||||||
protected
static
|
keygen(string $key, string $salt): string[]
Key derivation wth pbkdf2: http://en.wikipedia.org/wiki/PBKDF2
Key derivation wth pbkdf2: http://en.wikipedia.org/wiki/PBKDF2 Parameters
Overriden by |
# | ||||||||||
public
static
|
pbkdf2(string $key, string $salt, integer $length, integer $count, string $algo): string
Key derivation wth pbkdf2: http://en.wikipedia.org/wiki/PBKDF2
Key derivation wth pbkdf2: http://en.wikipedia.org/wiki/PBKDF2 Parameters
|
# | ||||||||||
public
static
|
hash_password(
string $password,
string $salt = false,
int $count = false,
string $algo = 'sha512',
string $type = 'php',
): string
Hash a password using PBKDF2 or PHP password_hash if availble
Hash a password using PBKDF2 or PHP password_hash if availble Parameters
Overriden by |
# | ||||||||||
public
static
|
check_password(string $password, string $hash): bool
Check a password against it's stored hash
Check a password against it's stored hash Parameters
Overriden by |
# | ||||||||||
public
static
|
unique_id(int $size = 128): string
Return a unique-enough-key for session cookie ids
Return a unique-enough-key for session cookie ids Parameters
|
# | ||||||||||
public
static
|
random(int $size = 128): string
Generate a random string
Generate a random string |
# | ||||||||||
| Properties | |||
|---|---|---|---|
protected
static
|
|
$method = 'aes-256-cbc'
|
# |
protected
static
|
|
$hmac = 'sha512'
|
# |
protected
static
|
|
$password_rounds = 86000
|
# |
protected
static
|
|
$encryption_rounds = 100
|
# |
protected
static
|
|
$hmac_rounds = 101
|
# |